python

  1. F

    Python Help needed with back tracking type algorithm

    I am trying to develop a swiss tournament pairing algorithm and I am essentially using a backtracking algorithm that gives a value for each terminal position based on how well it has matched the players. It seems to mostly be working but it will for some reason allow an empty pairing list with a...
  2. kkhhhkk

    Python Write an empty line at the end of my files

    I have the following code that writes out multiple files. I want this code to also write out an empty line at the end of each file produced, I've tried adding ('\n\') inside the loop however it adds an empty line to every line which is annoying i = 0 f = open('innput.txt','r') always_print =...
  3. Hartkeye

    Python Automated report writer

    Hello, i've come up with an idea for my very first project in python, and have some questions about formatting the data in an efficient way prior to writing the code for it. I want to be able to take data from tables i've created in an Excel file, and based on those data points, create a word...
  4. Hartkeye

    Brand new to coding - First project idea?

    Hello! I'm brand new to learning coding (Codewithmosh.com is what I'm currently learning C++ on.) I had an idea for a project that would help lessen my work load at my job. 90% of my work is writing reports. They are all very similar with small differences based on the contact. We write our...
  5. A

    Python Animated heatmap with Seaborn and matplotlib

    Hello everyone ! I’m trying to animate a heatmap for data visualization. (Just to clarify, I am a beginner in coding) The heatmap is generated from a matrix where cells situated at the center of the map take a +1 value at each iteration. I don’t use numpy for the matrix but comprehension...
  6. 8

    Python how to grouping/merge rows in to single row

    Greetings! Actually, I converted the PDF file containing the tables into a Pandas dataframe and then into Excel. Some cells in a PDF document contain multiline text. I've previously converted PDFs into a Pandas dataframe and then into Excel, but in those PDFs, the cells with multiline text had...
  7. U

    Python Error logging into facebook in python selenium

    from facebookUserInfo import username, password from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By import time class Facebook: def __init__(self,username,password): self.browser = webdriver.Chrome()...
  8. F

    Python Need help with my code for a tkinter gui youtube downloader - AttributeError: 'int' object has no attribute 'cget'

    First things first, Im german (strings in german aswell) and a bloody beginner when it comes to coding, but its fun and I want to improve. This code worked perfectly fine until a changed something that made this error appear: AttributeError: 'int' object has no attribute 'cget' The cget...
  9. User8574

    Python How do I remove the background of an image (Pygame)

    I tried using Gimp to make an alpha channel, I tried using convert_alpha(); how do I remove the background of an image on pygame?
  10. User8574

    Python Pygame: screen.fill and screen.blit not working, please help!

    # Modules import pygame, sys # Init / Clock pygame.init() clock = pygame.time.Clock() # Display Setup screen_width = 1920 screen_height = 1080 screen = pygame.display.set_mode((screen_width,screen_height)) pygame.display.set_caption("Coin Collector") # Objects coin =...
  11. User8574

    Python I make a global variable and then it says it isn't defined, wtf? (Python / Pygame)

    def ball_animation(): global player_score player_score = 0 player_score_surf = font.render(str(player_score), False, (10,10,10)) Apparently player score is not defined. Please help! I tried taking it out of the function above it and it still doesn't work.
  12. User8574

    Python 'Function needs at least three arguments' Pygame screen.blit error

    screen.blit(player_score_surf, (200,200)) I get an error that screen.blit requires three arguments. I tried adding centre as the third as the point of which is at 200,200, but that still doesn't work. How do I fix it?
  13. Hilton D

    Python The longest palindrome sequence

    A palinadrome is a nonempty string that reads the same forward and backward across some alphabet. Palindromes include all strings of length one, civic, racecar, and aibohphobia (fear of palindromes). Provide an efficient approach for determining the longest palindrome that is a subsequence of...
  14. 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...
  15. 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...
  16. 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...
  17. 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...
  18. VLSkill

    Python Which is a better method to start learning Python?

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