Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Use of pygame
Post: RE: Use of pygame

(Sep-30-2022, 06:27 PM)deanhystad Wrote: Post pygame questions in the pygame forum. Pygame programs have an event loop that keeps the program running. When the loop exists, the program ends. You ...
ebolisa General Coding Help 2 207 Sep-30-2022, 06:28 PM
    Thread: Use of pygame
Post: Use of pygame

Hi, The following code plays only the beginning of a file: pygame.mixer.init() pygame.mixer.music.load('my_music.mp3') pygame.mixer.music.play() pygame.mixer.music.set_volume(0.5)If I add some delay...
ebolisa General Coding Help 2 207 Sep-30-2022, 06:22 PM
    Thread: dnload/upload with FTP
Post: RE: dnload/upload with FTP SOLVED

Solved! Here's my new code (which I'm sure it can be improved): # open ftp connection ftp = FTP(ftp_server) # login ftp.login(url_username, url_pass) # 230 User user-7092639 logged in # change di...
ebolisa General Coding Help 4 351 Sep-07-2022, 11:17 AM
    Thread: dnload/upload with FTP
Post: RE: dnload/upload with FTP

Thank you much! I'm progressing. This code downloads a file in my directory but, because I'm working with a microprocessor I'd like to download the file into the memories, make changes and upload it ...
ebolisa General Coding Help 4 351 Sep-07-2022, 09:40 AM
    Thread: dnload/upload with FTP
Post: dnload/upload with FTP

Hi, What's the right syntax to connect to a ftp server and download a file? The following code cannot find the file however, I can with a ftp client app. TIA ftp_server = "192.168.1.10" url_userna...
ebolisa General Coding Help 4 351 Sep-06-2022, 11:01 PM
    Thread: Stripping numbers from text
Post: RE: Stripping numbers from text

(Jul-18-2022, 02:43 PM)snippsat Wrote: Can use regex. >>> import re >>> >>> para_array = ['s1=2.67', 's2=34', 'p1=1', 'p2=1'] >>> for item in para_array: ... ...
ebolisa General Coding Help 4 549 Jul-18-2022, 03:18 PM
    Thread: Stripping numbers from text
Post: Stripping numbers from text

Hi, The response from a web form fills an array. Its content may average from empty to several strings. I need to extract data from said strings so I can work with it. I came out with the following c...
ebolisa General Coding Help 4 549 Jul-18-2022, 01:26 PM
    Thread: Writing to json file
Post: Writing to json file

Hi At times, the below function writes an extra "}" in the json file and I cannot see where the problem may lie. I appreciate some guidance. Micropython running on Raspberry Pico W TIA # write to fil...
ebolisa General Coding Help 1 374 Jul-17-2022, 04:13 PM
    Thread: Simple encoding code
Post: RE: Simple encoding code

(Jun-18-2022, 12:45 AM)deanhystad Wrote: Limit your alphabet to only visible characters. This example limits the alphabet to upper and lowercase letters, Thank you. It works even with a little modi...
ebolisa General Coding Help 3 570 Jun-18-2022, 07:14 AM
    Thread: Simple encoding code
Post: Simple encoding code

Hi, This simple encoding code converts text to ASCII and adds a one digit number to it. It seems to work ok, but while testing it, I noticed that if a 'v' is used, it's converted to ' ' when a 9 is a...
ebolisa General Coding Help 3 570 Jun-17-2022, 09:44 PM
    Thread: Q on formatting
Post: RE: Q on formatting

(Dec-24-2021, 10:38 PM)Gribouillis Wrote: Personally I don't like these records with anonymous members. **biggrin** that reminds me of an Italian movie. An American tourist just arrived at the airpo...
ebolisa General Coding Help 4 809 Dec-24-2021, 10:53 PM
    Thread: Q on formatting
Post: RE: Q on formatting

(Dec-24-2021, 08:16 PM)BashBedlam Wrote: What ever works best for you **wink**I agree, however, one line coding is challenging.
ebolisa General Coding Help 4 809 Dec-24-2021, 09:53 PM
    Thread: Q on formatting
Post: Q on formatting

Hi, The variable ss retains a scanned list of local routers. I don't know why mine is shown twice but, that's a question for a different forum. The variable a retains the rssi of my first encountere...
ebolisa General Coding Help 4 809 Dec-24-2021, 07:33 PM
    Thread: Simple arithmetic question
Post: RE: Simple arithmetic question

(Dec-15-2021, 02:22 PM)deanhystad Wrote: What is the logic of your rounding? 12.45 should round to 12.Because 12.45 should be 12.5 and therefore, 13. 12.13 should be 12.1 and therefore, 12. More i...
ebolisa General Coding Help 5 1,064 Dec-15-2021, 02:39 PM
    Thread: Simple arithmetic question
Post: Simple arithmetic question

Hi, I'd like to round the number 12.13 to 12 and 12.45 to 13. None of the following functions return the format I'm looking for. I guess I could use if then function to get around it but, I'm sure th...
ebolisa General Coding Help 5 1,064 Dec-15-2021, 01:53 PM
    Thread: re.search Q
Post: RE: re.search Q

Thank you all. Actually the code shown in my first post is correct, there's an error in the string received from the URL which had the variables in the wrong order. So, once fixed that, the code works...
ebolisa General Coding Help 12 1,635 Dec-01-2021, 01:18 PM
    Thread: re.search Q
Post: RE: re.search Q

(Nov-30-2021, 06:15 PM)Gribouillis Wrote: I suggest this ersatz >>> {m.group(1): m.group(2) for m in re.finditer(r'([a-z]+)\=([^=&\n]*)', request)} {'q': '0.9\r', 'ssid': 'my_ssid', 'pa...
ebolisa General Coding Help 12 1,635 Nov-30-2021, 06:21 PM
    Thread: re.search Q
Post: RE: re.search Q

(Nov-30-2021, 05:33 PM)bowlofred Wrote: import re request = 'POST /configure HTTP/1.1\r\nHost: 192.168.4.1\r\nOrigin: http://192.168.4.1\r\nContent-Type: application/x-www-form-urlencoded\r\nAccept-...
ebolisa General Coding Help 12 1,635 Nov-30-2021, 06:07 PM
    Thread: re.search Q
Post: RE: re.search Q

(Nov-30-2021, 04:37 PM)bowlofred Wrote: The entire regex has to match. Your regex has the string "sbnet=(.*)&gw=(.*)", but that isn't in your request string. Instead the request string has the...
ebolisa General Coding Help 12 1,635 Nov-30-2021, 04:43 PM
    Thread: re.search Q
Post: re.search Q

Thanks, but I'm still struggling with my code and don't have other choice but to use 're.search()'. Here's an updated code which, when the variables are searched individually, it works but not when s...
ebolisa General Coding Help 12 1,635 Nov-30-2021, 04:29 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020