Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: multiplying elements in a list
Post: RE: multiplying elements in a list

Hello, you can try this: a = [4, 0.8, 23] b = [0.3, 2, 3] c = list(map(lambda x: x[0] * x[1], zip(a, b))) print(c)Best Regards, Nicolas TATARENKO
avorane General Coding Help 3 3,430 Feb-27-2020, 02:25 PM
    Thread: "if not" not doing as expected - why not?
Post: RE: "if not" not doing as expected - why not?

Hello, Can you check the carriage return encode of two files? If it's Windows, the carriage return is '\r\n', if unix, it's '\n'. Best Regards, Nicolas TATARENKO
avorane General Coding Help 6 2,528 Dec-31-2019, 09:15 AM
    Thread: Replace last 4 bytes of a timestamp
Post: RE: Replace last 4 bytes of a timestamp

Hello, When I try the code with new bytes that you hage given, i get a difference near 1 second (~1.1718)(WARNING: new bytes in the code are different of the question). Can you give me the dates whe...
avorane General Coding Help 18 7,393 Sep-16-2019, 03:37 PM
    Thread: Replace last 4 bytes of a timestamp
Post: RE: Replace last 4 bytes of a timestamp

Hello, Can you try this? from datetime import datetime import math old_date = "2019-08-06T07:37:51.358999986Z" print("old date: {}".format(old_date)) splited_date = old_date.split('.') old_date_wit...
avorane General Coding Help 18 7,393 Aug-28-2019, 09:12 PM
    Thread: Replace last 4 bytes of a timestamp
Post: RE: Replace last 4 bytes of a timestamp

Hello, Do you think it's the response: from datetime import datetime old_date = "2019-08-06T07:37:51.358999Z" new_bytes = [0xc8, 0xdc, 0xdc, 0x65] t = datetime.strptime(old_date, "%Y-%m-%dT%H:%M:%S....
avorane General Coding Help 18 7,393 Aug-27-2019, 09:57 PM
    Thread: OpenCV - Distinguishing between three icons
Post: RE: OpenCV - Distinguishing between three icons

Hello, If you have only three templates, you can use the template matching of OpenCV after get this three template in picture files: https://docs.opencv.org/3.0-beta/doc/py_...ching.html
avorane General Coding Help 2 1,966 Jul-30-2019, 05:25 AM
    Thread: Getting type from input() function in Python 3.0
Post: RE: Getting type from input() function in Python 3...

Hello, Sorry. Yes, we don't need evaluate the length. It's a bad memory :) In my memory if you evaluate for example '2.5' with int() it returns 2. But no. The length evaluate was in this case. Nicol...
avorane General Coding Help 7 3,749 Jul-29-2019, 08:28 PM
    Thread: Getting type from input() function in Python 3.0
Post: RE: Getting type from input() function in Python 3...

Hello, A little script for evaluate: import sys def is_integer(value): try: tmp = int(value) if len(str(tmp)) == len(value): return tmp else: retu...
avorane General Coding Help 7 3,749 Jul-29-2019, 07:35 PM
    Thread: read text file and write into html with correct link
Post: RE: read text file and write into html with correc...

Hello, Try with open('test.txt') as f,open('out.html', 'w') as f_out: for line in f: line = line.strip() #print("<a href=",line ,"</a>","link") #print ...
avorane General Coding Help 4 2,909 Jul-25-2019, 10:50 AM
    Thread: Have two class instances affect one another
Post: RE: Have two class instances affect one another

Hello, I think it's right like result. You set name of S to Jack and call one on this. So attribut m equal 5. You set name of P with other value. So attribut m equal 0. And you call two on P. It r...
avorane General Coding Help 3 2,292 Jun-26-2019, 06:35 PM
    Thread: How to get first line of a tuple and the third item in its tuple. Need Help, Anybody?
Post: RE: How to get first line of a tuple and the third...

Hello, Can you send all code in module, please? Best Regards, Nicolas TATARENKO
avorane General Coding Help 5 3,207 May-21-2019, 11:39 AM
    Thread: Problem with elif statement
Post: RE: Problem with elif statement

Hello, I think the problem become of call input in tests. When you enter in the "if", you call input(). If it isn't the value expected, you enter in the "elif" where you call a new input(). Try: po...
avorane General Coding Help 2 2,277 May-20-2019, 09:26 AM
    Thread: Type error when reading in different data types on an __init__ method
Post: RE: Type error when reading in different data type...

Hello, When you print the result, you call twice duration. However, you have still defined a print fonction in the class Duration. So: class Duration(object): def __init__(self, minutes=00, sec...
avorane General Coding Help 3 2,807 May-09-2019, 11:41 AM
    Thread: zip lists with condition
Post: RE: zip lists with condition

Hello, I suggest this: a = [1,2,3,4,5] b = [ [], [], ["a", "b"], ["e", "f"], [] ] l = [elt for elt in zip(a,b) if elt[1]]Best Regards, Nicolas TATARENKO
avorane General Coding Help 6 4,041 May-09-2019, 09:35 AM
    Thread: Find index of missing number
Post: RE: Find index of missing number

I suggest this: def missing_numbers(num_list): original_list = [x for x in range(num_list[0], num_list[-1] + 1)] diff_list = [] for index, elt in enumerate(original_list): ...
avorane General Coding Help 3 3,156 May-07-2019, 10:52 AM
    Thread: How "continue" in another indentation?
Post: RE: How "continue" in another indentation?

Maybe by this way: #lots of code before this for folder in subdirs: os.chdir(str(subdirs[subdirnumber + 1])) #opens the subfolder pdflist = glob.glob("**/*.pdf", recur...
avorane General Coding Help 6 3,047 May-07-2019, 10:38 AM
    Thread: Screenshot of specific window
Post: RE: Screenshot of specific window

Hello, We have tested this method on a project, but it dosen't work for we. And what is the result for you? The solution was the DPI option on the python executable. Normally, you can find it in t...
avorane General Coding Help 10 19,339 Nov-30-2018, 09:59 AM
    Thread: Screenshot of specific window
Post: RE: Screenshot of specific window

Hello, For pywin32, have you executed the script [dir_of_python]\Scripts\pywin32_postinstall.py with the command "python pywin32_postinstall.py -install"? Sorry, but i have not windows and so cannot...
avorane General Coding Help 10 19,339 Nov-29-2018, 11:19 AM
    Thread: Screenshot of specific window
Post: RE: Screenshot of specific window

Hello, Sorry for my bad comprehension. You can find a solution here: https://stackoverflow.com/questions/1969...w-win32gui Best Regards, Nicolas TATARENKO
avorane General Coding Help 10 19,339 Nov-28-2018, 08:55 AM
    Thread: Screenshot of specific window
Post: RE: Screenshot of specific window

Hello, With the library pywin32, you can. When you get the identifier of the window (for example by the name) you can set it to the foreground with the function SetForegroundWindow. Here, an example...
avorane General Coding Help 10 19,339 Nov-26-2018, 05:51 AM

User Panel Messages

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