[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ Daily Python Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 85
Thread images: 7

File: pypy.jpg (13KB, 236x346px) Image search: [Google]
pypy.jpg
13KB, 236x346px
What are you working on /g/?


>Learn Python
https://automatetheboringstuff.com/
https://www.codecademy.com/
https://python.swaroopch.com/
https://www.reddit.com/r/learnpython/

>Online IDE
http://ideone.com/
>>
oh, some tic tac toe

http://pastebin.com/ayU4bZK4
>>
working on finding a linux text editor that will allow me to run my python code by a simple keyboard shortcut.
>>
>>58877413

thinking of making a driving game for terminal, but cant figure out how to let go of acceleration to shift gears

import time

def kp(char_width=1):
import os
#is it a unix-like system?
if os.name == 'posix':
import sys, tty, termios
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(char_width)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
#is it a windows system?
elif os.name == 'nt':
from msvcrt import getch
return "".join([getch() for i in range(char_width)])
#system unknown, user will have to use enter key :(
else:
return input()


def gear_switch(gear):
print("Zoom Zoom Zoom!")
time.sleep(gears.get(gear))


def ZOOM():
gear = 1
moving = True
while moving == True:
is_gear = kp()
if is_gear.isdigit() == True:
is_gear = int(is_gear)
gear = is_gear
gear_switch(gear)


gears = {
1:0.7,
2:0.5,
3:0.3,
4:0.2,
5:0.1
}


ZOOM()

>>
>>58877460
does it have to run in the terminal? idle and pycharm have ipythons
>>
>>58877413
>Learn Python
For what purpose? Learn to program and just look up shit for python when you need.
>>
>>58877488
i would prefer it to run in the terminal

on windows I have notepad++ setup so I can save my project, hit ctrl-r and it will run in the command prompt window
>>
What's python best at?
Why should I prefer it over javascript?

pls respond
>>
>>58877932

it's the swiss army knife of languages. great for getting lots of shit done, but you wouldn't want to build a house with it.
>>
>>58877460
IDLE (F5) or Sublime Text (ctrl+b).
>>
>>58878767
>Sublime Text (ctrl+b).
Not him but my test program seemingly won't let me submit input.
>>
>>58877413
Made this little keyboard drawing program playing around with pygame. equals and minus key turn the paint trail on and off, enter key fills the screen with the selected colour, and the r, g, b, y, w, and n keys select different colours. I'm planning to build some kind of snake game out of it later.

http://pastebin.com/dfr2DvSN
>>
i need you to decrypt this

Û·6g›^$«cïèí–UOñÏ5ƒçÅÔ 1é„æ`Ei°¤FEͬó
>>
>>58877473
Is there more? I don't see any part about acceleration, or terminal drawing.

Also, recommend moving some of the stuff in kp() that only needs to run once to some sort of init
>>
>>58877413
Why do so many people associate python with snakes?

You do realize it was named after Monty Python right?
>>
>>58880748
The fucking logo is two snakes
>>
>>58881094
That doesn't mean anything.
>>
>>58877413
Seriusly, python daily thread?
>>
>>58877413
I'm working on learning an in-house toolkit for creating web applications. Essentially BI and "everything you can do in Excel".

Since Excel is shit, this is a good thing.
>>
>>58881104
>what's on the logo has nothing to do with company image
How can somebody be this autistic? It's like they have no idea how the world works at all.
>>
>>58877413
Would you please elaborate on why you thought this deserves its own thread and can't be discussed in the daily programming thread?
>>
>>58881150
>All this projection
You're wrong and you know it.
>>
>>58877413
I'm currently making simple news bot, which check newsfeeds for special keywords and if it find, then will add in my Pocket account. This shit could save me time on checking news
>>
>>58881272
Care to share some concepts?
>>
>>58877413
praised be snek

this is great for learning
http://www.pythontutor.com/visualize.html#mode=edit

it visualizes python making it easier to understand
>>
File: 1485565053506.jpg (408KB, 2048x1289px) Image search: [Google]
1485565053506.jpg
408KB, 2048x1289px
>>58881176
Special snowflake syndrome.

I expect daily C, C++, and Lisp threads to follow.
>>
>>58881176
other chans have dedicated programming boards
>>
>>58877413
>>
Working on an automation thing to archive documents that haven't been accessed for a week, however I'm having trouble with reading and using files that are not in the working directory.
>>
>>58877473
You should simplify things like
 while moving == true 
to
 while moving 

And for false do something like
 if not moving 
>>
File: 1476334782078.gif (186KB, 678x422px) Image search: [Google]
1476334782078.gif
186KB, 678x422px
>>58881194
Not him but
>why would this be associated with snakes?
>Python is a type of snake
>Logo, which is a major part of the brand image, is 2 snakes and nothing else
>those snakes have nothing to do with it stop projecting you're so wrong

This is just low quality b8
>>
>>58881623
>not him
Nice damage control
Just admit you're retarded
>>
>>58881643


>>58881623
This is me
>>58881150
>>58881094
This is not

Screenshot for
>>
File: Screenshot_20170210-034559.png (123KB, 720x1280px) Image search: [Google]
Screenshot_20170210-034559.png
123KB, 720x1280px
>>58881643
Now quit being a nigger
>>
>>58881426
It's really pretty dumb bot. Once per 1 hour bot will check rss feeds in approximately 20 sites such as arstechnika, wired, hackernews etc. using feedparser package (but i want to replace it with my own rss parser) for keywords such as 'machine learning', 'cryptocurrency' etc and then bot adds url of article to my Pocket account with tag 'RSS bot' in order to check them easily
>>
>>58881663
>>58881672
>getting on a proxy just because you got roasted
lmao get a life
>>
>>58877413
What does /dpt/ think of Go and what does /dpt/ think of Go compared to python?
>>
So, using python's requests module, I'm querying an API and it returns something that looks like this:

{"config":{"world":17},"result":[{"timestamp":1486695000,"vs":452,"nc":512,"tr":543,"unknown":2}],"timing":{"start-ms":1,"query-ms":1,"process-ms":0,"total-ms":2}}[/code]

How would I go about pulling out the values of "vs", "nc", and "tr", and storing them in some variable?

pls no bully, completely new to python
>>
>>58884625

Go will BTFO python.
>>
>>58885203

How come
>>
>>58884625
Go is better for web dev.
>>
>>58884632
http://lmgtfy.com/?q=parsing+json+python
>>
>:
>>
>>58877413
what the fuck is this cancerous shit
>>
why the fuck is this at 8th page?

challenge:
make a function which deletes all the elements found in ys from xs

extra hard: dont use built in library solutions
>>
>>58887861
This thread is invalid. Let it die; go to the proper thread.
>>
>>58877473
give your car some inertia, with a speed that ticks down while the foot is off the gas to allow you to coast while shifting
>>
>>58887861
(define (delet-this xs ys)
(foldr (lambda (x acc)
(if (member x ys)
acc
(cons x acc)))
'()
xs))


(delet-this '(1 2 3 4 5) '(2 3 4)) => (1 5)
>>
>>58877413
working on a tk GUI application because I didn't know how better is Java at this kind of things when I started the project.
>>
>>58887861
set(xs) - set(ys)
>>
test


ḍ̶̷͉̪͈͚͎̔ͫ͂͋ͨ̿̊̑̓̿̓ͭͭ̇́̌͊́̚̚͝
Part
>>
>>58877932
General programming.

>>58879684
Looks like a messed up encoding with the same codepoints as the code points from the unicode "string".

>>58880748
Tard

>>58884632
response.json()

>>58886309
A Python thread.

>>58892381
OrderedSet for preserved order. Alternatively:
> [x for x in xs if x not ys]

>>58891434
Try not using tk, check out PyQt/PySide.
>>
>>58877460
I believe emacs has one
>>
>>58892620
*not in ys
>>
networking for my decentralized TV system
>>
wrote a bot for a game
i couldn't send the enter key event though
so i resorted to python (even though I don't use Python) and its pyautogui library
i was very pleased, it's very easy to use.

question for anyone who has experience with pyautogui or any gui automaters - is it possible to send the enter key event to a window that is not focused, or even minimized?
>>
Why should I learn python instead of C++ as my first language?
>>
>Û·6g›^$«cïèí–UOñÏ5ƒçÅÔ 1é„æ`Ei°¤FEͬó

$Hɘd¡ÛTœ<Piª°0Ê|:+ßÎ{Ÿº–O[¹º2S

your welcome
>>
>>58880748
it was the only anime python I could find
>>
>>58887861
foldr $ \y -> filter (/=y)
>>
>>58892764
Very likely not. Something like this is theoretically possible if you hook directly into the executable's code in RAM and modify what events the event loop receives, but afaik this isn't just simply possible. I might be totally wrong though.
>>
File: 1483073157801.jpg (110KB, 1280x720px) Image search: [Google]
1483073157801.jpg
110KB, 1280x720px
/g/ cool kids club checklist

[x] hate OOP
[x] hate IDEs
[x] never produce actually useful software (this is important)
[x] tiling window manager
[x] dark-like-my-soul customized colors
[x] 40% keyboard with braided cables and custom caps
[x] hate Apple
[x] hate popular Linux distributions (far too intelligent for them)
>>
>>58881176
Cause I knew when I came back 24 hours comments like these would keep it alive

/sage/
>>
>>58892895
danm it, only five checks
>>
>>58892895
>never produce actually useful software (this is important)

it's amazing at how many people approach programming in the same way grandmas approach crossword puzzles
>>
>>58892895
does notepad++ count as an IDE?
>>
>>58879588
I believe neovim has a built in terminal emulator

I think $editor and a shell inside tmux is a better solution for you though. More powerful and versatile.
>>
File: ISITAWAKE.png (1MB, 2248x1430px) Image search: [Google]
ISITAWAKE.png
1MB, 2248x1430px
>>58877413
is it awake /g/?
>>
>>58877932
Python is good for being a good little gayboy and telling the world you're a gayboy.
>>
>>58892973
no, obviously not

it's basically a souped-up text editor.
>>
>>58892895
I don't think people here hate popular gnu/linux distributions, Fedora, Debian, Arch are all pretty well received, and they are really popular. The problem is mainly with Ubuntu and its derivatives.
>>
>>58892858
If you learn Python first you will forever be a gayboy. If you want to really learn to program learn C++, though you may want to begin with C first and then move on to C++.
>>
>>58894725
>Ubuntu
What's the problem?
It's good enough for Donald Knuth
>>
>>58894699
>>58894739
Did a python script rape your mother or something? Oh are you just projecting your latent homosexuality onto a programming language for no good reason?
>>
>>58882792
You tried
Still low quality b8
>>
>>58877991
that's a good analogy senpai
>>
File: 1486472040738.jpg (73KB, 604x604px) Image search: [Google]
1486472040738.jpg
73KB, 604x604px
Say I have a text file with a list of terms in it separated by newlines. Can I write a program to concatenate those terms with a web address like "https://www.google.com/#q=" + "$yourterm" and open them all in a web browser? I have 2000 terms I need to search.
>>
>>58896608
>>58896666
Stop bumping this invalid thread.
It should have died hours ago.
Go post in the real /dpt/: >>58894674
>>
>>58892858
Python is probably the best "get your hands dirty" language since the syntax is so simple and you can start making fun programs very quickly.

C++ is just a massive clusterfuck suited for big applications, but you could learn that too. I'd recommend Python tho bro
>>
>>58896765
>Python is probably the best "get your hands dirty" language since the syntax is so simple and you can start making fun programs very quickly.
You misspelled 'C'
>>
>>58896666
sed 's|^|https://www.google.com/#q=|g' file > urlsfile
The second part, well...
for line in `cat urlsfile` ; do chrome $line ; done
Or something like that. I heard browsers can accept URL as a parameter.
>>
>>58896666
you COULD, but that is the kind of thing notepad++ is better suited for
>>
>>58897160
>>58896816
>>58896795
>>58896765
See >>58896697

Also, that anon's question was answered ages ago.
>>
>>58897194
>>58896697

just hide this thread if it make you so butthurt. you're embarrassing yourself.
>>
>>58896666
lmao have fun getting 10 results and 1990 CAPTCHA prompts.
Thread posts: 85
Thread images: 7


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.