/dpt/ Daily Python Thread

What are you working on Sup Forums?


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

>Online IDE
ideone.com/

Other urls found in this thread:

pastebin.com/ayU4bZK4
pastebin.com/dfr2DvSN
pythontutor.com/visualize.html#mode=edit
lmgtfy.com/?q=parsing json python
google.com/#q=|g'
twitter.com/AnonBabble

oh, some tic tac toe

pastebin.com/ayU4bZK4

working on finding a linux text editor that will allow me to run my python code by a simple keyboard shortcut.

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()

does it have to run in the terminal? idle and pycharm have ipythons

>Learn Python
For what purpose? Learn to program and just look up shit for python when you need.

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

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.

IDLE (F5) or Sublime Text (ctrl+b).

>Sublime Text (ctrl+b).
Not him but my test program seemingly won't let me submit input.

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.

pastebin.com/dfr2DvSN

i need you to decrypt this

Û·6g›^$«cïèí–UOñÏ5ƒçÅÔ 1é„æ`Ei°¤FEͬó

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

Why do so many people associate python with snakes?

You do realize it was named after Monty Python right?

The fucking logo is two snakes

That doesn't mean anything.

Seriusly, python daily thread?

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.

>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.

Would you please elaborate on why you thought this deserves its own thread and can't be discussed in the daily programming thread?

>All this projection
You're wrong and you know it.

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

Care to share some concepts?

praised be snek

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

it visualizes python making it easier to understand

Special snowflake syndrome.

I expect daily C, C++, and Lisp threads to follow.

other chans have dedicated programming boards

...

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.

You should simplify things like
while moving == true to
while moving
And for false do something like
if not moving

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

>not him
Nice damage control
Just admit you're retarded

This is me
This is not

Screenshot for

Now quit being a nigger

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

>getting on a proxy just because you got roasted
lmao get a life

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

Go will BTFO python.

How come

Go is better for web dev.

lmgtfy.com/?q=parsing json python

>:

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

This thread is invalid. Let it die; go to the proper thread.

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

(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)

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.

set(xs) - set(ys)

test


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

General programming.

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

Tard

response.json()

A Python thread.

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

Try not using tk, check out PyQt/PySide.

I believe emacs has one

*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

it was the only anime python I could find

foldr $ \y -> filter (/=y)

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.

Sup Forums 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)

Cause I knew when I came back 24 hours comments like these would keep it alive

/sage/

danm it, only five checks

>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

does notepad++ count as an IDE?

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.

is it awake Sup Forums?

Python is good for being a good little gayboy and telling the world you're a gayboy.

no, obviously not

it's basically a souped-up text editor.

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.

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++.

>Ubuntu
What's the problem?
It's good enough for Donald Knuth

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?

You tried
Still low quality b8

that's a good analogy senpai

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 "google.com/#q=" + "$yourterm" and open them all in a web browser? I have 2000 terms I need to search.

Stop bumping this invalid thread.
It should have died hours ago.
Go post in the real /dpt/:

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

>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'

sed 's|^|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.

you COULD, but that is the kind of thing notepad++ is better suited for

See Also, that user's question was answered ages ago.

just hide this thread if it make you so butthurt. you're embarrassing yourself.

lmao have fun getting 10 results and 1990 CAPTCHA prompts.