python

  1. skifli

    Python Encapsulation in Python

    I recently learned about encapsulation in Python, and how you could specify private variables in classes that can't be accessed outside of the class (by prefacing the variable with '__'). However, this actually only mangles the name of the variable to...
  2. P

    Python Flask and Jinja syntax. How to get a name to show on another page?

    I am trying to make a web app using Flask, but I am having trouble with the Jinja syntax. I am following CS50. I want to take the student's name and dorm from index.html and display it on success.html. However, I am unable to do this. All that displays is "You have successfully registered...
  3. Veronica

    JavaScript Want more resource

    We can use binary search to find the target element in an array. First, we need to sort the array in ascending order. Then, we can use binary search to find the target element in the sorted array. The time complexity of this approach is O(nlogn), where n is the number of elements in the Array...
  4. K

    Python How to send data frame to another neural net in flask route

    So, I have flask app with py-cicflowmeter. Purpose - detection of network attacks. According to my idea, two neural networks are used. The first is a fast binary LSTM classifier, and the second is a slow multiclass KNN. Both networks are pretrained and have 23 inputs each, with the same input...
  5. VLSkill

    Python Which is a better method to start learning Python?

  6. Linh Lee

    Python SyntaxError: invalid syntax (help)

    Trying to search/delete for specific user with one letter name, "a", and always changing domains. Some addresses from this spam: [email protected] [email protected] [email protected] Need help please, fixing invalid syntax error. CODE: from imap_tools import MailBox, A with...
  7. P

    Python Expression expected ; Statement expected

    So hey guys I am totally new to coding and I tried to make a programm that would show me my recipe for my pancakes etc. if I type a certain number from 1 to 3 in there. But it came with a couple problems I dont know how to solve since this is my first time. the first is at print(for) and the...
  8. Linh Lee

    Python imap_ssl.search one letter name

    resp_code, mails = imap_ssl.search(None, '(FROM "a")') I want to search emails from a specific one letter named user, "a". Example: <[email protected]> <[email protected]> Problem is, search results cause all users with an "a" as part of their name to be returned. Example: [email protected]...
  9. User8574

    Python I'm not sure what this means and if pygame has been installed successfully.

    (Visual Studio) I installed the newest version of pygame but I'm not sure if it was installed properly. Anyone know? Thanks a lot.
  10. Linh Lee

    Python Yahoo imaplib errors

    Want to search folder "SPAM", for [email protected] domain, and delete found mail. Code below ... import imaplib box = imaplib.IMAP4_SSL('imap.mail.yahoo.com', 993) box.login("[email protected]","xxxxxxxxxx") box.select('SPAM') typ, data = box.search(None, 'from','name@*.*') for num in...
  11. Linh Lee

    Python Imaplib [search, move, delete] Yahoo Mail

    Any python experts willing to share there knowledge, please?! Want to: 1. Search ALL folders including SPAM, for "[email protected] (wildcard) domain" 2. Move those emails to folder called DUMP 3. Delete contents of DUMP Unfortunately I can't figure out how to do what I need above in Yahoo...
  12. shivambhatele

    Python Which Python Framework is more Flexible in Large Projects?

    Hello All, I am new in python programming and got the opportunity to work on a large project which is based on finance domain. I want to know which python framework is more flexible between Flask and Django in a large project. I have asked this quey on Quora and according to this source, Django...
  13. amirgh21593

    Python Solving Supply Chain Logistics Problem with Ant Colony Optimization

    Hi! I'm currently working on my university project. the link to the article which I'm referencing is Accelerating supply chains with Ant Colony Optimization across a range of hardware solutions and its dataset is available Supply Chain Logistics Problem Dataset. I would appreciate it if there is...
  14. P

    Python Best way to rerun this snippet of code:

    New to python3 working on a fantasy character generator, tyring to find the best way to rerun the snippet of code if the wrong letters are entered in input. Thanks for any help you can give me. #Code to exit or reginirate script quittogen = input("""\nDo you want to quit or generate another...
  15. voldyy

    Python Digit into number

    Hi, how can i change this code to work for two-digit numbers or three-digit number? For now only work for single digit numbers, tried to change algorthm but didnt work. def to_number(digits): result=digits[0] for el in digits[1:]: result=result*10 result=result + el...
  16. stevan

    Python Python compiling error (Python Beginner)

    I'm trying to get data from my temperature and humidity sensor and write the data to a JSON file every minute. I started learning Python two days ago, so I have no idea why these errors occur (the output is in the attachment): The Code: import time import board import adafruit_dht import...
  17. C

    Python Request for help with basic statistics using NumPy

    Please see the attachments. I do not understand how to insert the required numbers. Many thanks in advance for any wisdom you may proffer.
  18. notaverygoodprogrammer

    Python How to fix beginner project issue (Guess the Number game)

    Hi, I'm working on a small game where the computer generates a number, and you have to input (like guess) a random number. Then, the computer will tell you whether the guessed number is too big or too small, or if you guessed it right. I might not have imported the random number correctly, but...
  19. AzureEyed

    Python Python - simple beginner question

    Hello, I wanted to ask for a shortcut to mark multiple lines and put them as comment, I don't mind if each line has # at the beginning for example: The code is: 1. print("hello world") 2. print("hello world") 3. print("hello world") I want to make it: 1. # print("hello world") 2. # print("hello...
  20. choppingbl0ck

    Python What's an alternate solution to building a pyramid?

    This is what I have so far. I'm told it's not acceptable. Any ideas on a different way to do this? I have to use loops def print_pyramid(str,h): if str=="right": for i in range(h): print('#' * (i+1)) elif str=="left": for i in range(h): print('...
Top Bottom