Im trying to make a project similar to this one, where i have a thermal printer hooked up to a raspberry pi. From a 16x2 i2c board, i'd select one of 15 folders, then it would randomly send one of the files contained in the folder to the thermal printer. files are numbered 1,2,3,4... if that helps. I have no idea where to start with it, and i'd love some help. submitted by /u/Invisible_Walrus [link] [comments]
Hi, i have a question about this: class subclass: def __getattr__(self,attr): return 2 a=subclass() b=getattr(a,'undefined',3) #reference to undefined attribute here, but with a default print(b) #the result is 2 not 3 So when we refer to an undefined attribute with a default value by getattr function, we get back what return by __getattr__ method, not the default we gave the getattr function. So are there any ways we can get the return value of __getattr__ when we didn't provide default for getattr...
I am fairly new to Python so forgive me for my lack of knowledge. I was playing poker with a friend earlier today and she shuffled the cards with one half facing up and the other facing down. So I flipped each one over individually and had all cards facing one side. Then I thought of a scenario where a list had items with multiple values, true or false. I considered the true value to be face up cards and the false value to be face down cards for simplicity. If I wanted to run a for loop to make all...
If there is no module then how would I go about it then? submitted by /u/ZebusAqua [link] [comments]
I could use some advice from anyone who’s had to do the same. I mainly want to know the best way to work with such a large dataset. I was using chunking to concat the file but wanted to be sure it was the best way and not just me wasting time. Maybe you think pandas or python isn’t the right tool and have another you can recommend? Thanks! submitted by /u/Ksingh210 [link] [comments]
while True: text=input() if len(text)!=10: print('No') elif text[0]!=0: print('No') else: print('Yes') When I entered '000', the computer responded 'No'(so that's good), entered '1234567890', responded 'No'(also good), but when I entered '0000000000' which has 10 digits and begins with '0', it still responded 'No'. Can anyone point out what's wrong in my codes? Thank you in advance. submitted by /u/username4224 [link] [comments]
working on an assignment now and would really appreciate a live tutor instead of youtube videos, if anyone is able and willing to help i would be super thankful! we are covering data files and iterating rows and analyzing the data in the files submitted by /u/yeethay23 [link] [comments]
Been self-learning Python for the past year. I made a PR to youtube-dl to add an extractor a few months ago after pouring over codebase and documentation. And after a long wait for a review and some back and forth, it was merged! Not only can you download videos from Pornhub but now also from Yahoo News Japan😂 https://github.com/ytdl-org/youtube-dl/pull/21265 submitted by /u/kylepw [link] [comments]
Evening all, I will begin by saying that I am a massive fan or this sub, and developing my own machine learning project is something I have wanted to start for a while. I have found a number of python projects which predict stock price movements on GitHub, but have been unable to successfully run the code. Using the the below as an example, could someone explain how to run this project, and it what order each file needs to be ran in? https://github.com/scorpionhiccup/StockPricePrediction I apologies...
from tkinter import * root = Tk() canvas = Canvas(root, width = 300, height = 300) canvas.pack() img = PhotoImage(file="C:\Users\MidthoughtPause\Desktop\sample.gif") canvas.create_image(20,20, anchor=NW, image=img) mainloop() I'm using this webpage for instructions https://www.programcreek.com/python/example/7946/Tkinter.PhotoImage I would get a pop-up window saying it can't decode bytes in position... submitted by /u/MidThought_Pause [link] [comments]
Like title, how do I know which file is the starting point to start reading? submitted by /u/SaladMandrake [link] [comments]
My travis build is failing because pip installs another version of setuptools than what is intended. I tried many things like uninstalling pipenv but it doesn't seem to fix it. https://travis-ci.org/Utkarsh1308/coala/jobs/561856001 Has anyone encountered this problem before and knows how to solve this? submitted by /u/horrorlover2 [link] [comments]
Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread. * It's primarily intended for simple questions but as long as it's about python it's allowed. If you have any suggestions or questions about this thread use the message the moderators button in the sidebar. Rules: Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will...
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου