Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Store a python list of lists in a database to use for searches later on
Post: RE: Store a python list of lists in a database to ...

You can save the addresses to the separate table (one address per row). Use indexes on columns where you'll do the searching and you're ready to go. Easy to implement in any DB engine.
ODIS General Coding Help 3 3,076 Jun-20-2019, 06:03 AM
    Thread: changing format to Int
Post: RE: changing format to Int

Oh, sorry, now I see that data['Imports_vfd'] has Pandas Series data type. So you must first convert it to the string, then do the replace and then convert it to the integer: # converting Pandas Seri...
ODIS General Coding Help 3 2,466 Jun-19-2019, 06:33 AM
    Thread: changing format to Int
Post: RE: changing format to Int

If the dash in string represents the thousands separator, just get rid of it first: int(data['Imports_vfd'].replace(",", ""))
ODIS General Coding Help 3 2,466 Jun-18-2019, 08:09 AM
    Thread: beginner questions
Post: RE: beginner questions

Possible solution: def check_password(password: str): if len(password) < 10: raise Exception("password must have at least 10 characters") has_digit = False has_lowercase = Fals...
ODIS Homework 5 3,444 Jan-18-2019, 11:15 AM
    Thread: assert
Post: RE: assert

This is not valid verification of the number type: gender is int() or float()And the hidden problem is that you get your variables as a strings (with the input() function). So the similar valid verifi...
ODIS General Coding Help 1 2,051 Jan-16-2019, 05:06 PM
    Thread: writing numbers to csv file
Post: RE: writing numbers to csv file

I would say that you have to pass the list of columns to the writerow() function: import csv x2 = [1, 2, 3] y2 = ["a", "b", "c"] with open("./outputfile.csv", "w") as file: csv_writer = csv.wri...
ODIS General Coding Help 7 4,060 Dec-19-2018, 11:13 AM
    Thread: issue in using dictionary
Post: RE: issue in using dictionary

Can you post your current code including the file lines processing?
ODIS General Coding Help 5 3,077 Nov-26-2018, 10:45 AM
    Thread: issue in using dictionary
Post: RE: issue in using dictionary

Hello amar, you can do it like this: lines = [ {'name':'ename','data':'str','len':'2','add':'bgl','out':'y','zip':'3567','add/blr':'Y'}, {'name':'another_name','data':'str','len':'2','add':'...
ODIS General Coding Help 5 3,077 Nov-23-2018, 02:22 PM
    Thread: While loop with List and if stmt
Post: RE: While loop with List and if stmt

More readable way suggestion: Var1 = [27923320, 27547329, 21171382, 21463894, 18961555, 28432129] for item in Var1: if item in [27923320, 27547329]: print("Yes") else: print(...
ODIS General Coding Help 3 2,463 Oct-23-2018, 05:42 AM
    Thread: merging lists, dedup and keeping order, in older pythons
Post: RE: merging lists, dedup and keeping order, in old...

I think they do (some hashtable data structure probably). But ordering is in Python 3.7 implemented only for the the dictionaries. You can check out the source code: https://github.com/python/cpython...
ODIS General Coding Help 3 3,168 Oct-19-2018, 01:30 AM
    Thread: merging lists, dedup and keeping order, in older pythons
Post: RE: merging lists, dedup and keeping order, in old...

Sets don't keep order and python doesn't include built-in ordered sets. But you can use ordered dictionary from the collections package which is also in Python 2: from collections import OrderedDict ...
ODIS General Coding Help 3 3,168 Oct-11-2018, 03:21 AM
    Thread: Giving class multiple arguments
Post: RE: Giving class multiple arguments

You must use class key word instead of def for Restaurant class: class Restaurant(object): def __init__(self, name, food): self.name = name self.food = food def restaurant_i...
ODIS General Coding Help 1 4,561 Oct-04-2018, 11:25 PM
    Thread: Update vs copy methods
Post: RE: Update vs copy methods

Hello jankislinger, From my point of view: I always try to make my classes as simple and clear as possible. I would keep in your class only method for update the property: class Foo: def __init__(...
ODIS Data Science 4 2,960 Oct-03-2018, 10:32 PM
    Thread: os.popen output to a list ..
Post: RE: os.popen output to a list ..

You need to split the process output string by line break. Like this: import os # reading the output output = os.popen("""wmic process get name | findstr /v "Name 'System Idle Process' System""").re...
ODIS General Coding Help 1 5,317 Oct-02-2018, 08:42 PM
    Thread: Signature verification
Post: RE: Signature verification

I'm sorry, I don't understand what you're trying to say about the public key. Try to present a full example with some test keys and I would like to try to help.
ODIS General Coding Help 8 5,247 Sep-30-2018, 10:23 PM
    Thread: Signature verification
Post: RE: Signature verification

Restrictions? :) I'm fortunately not restricted to create some test keys. digest.update() method is not returning anything - the method updates the digest object. Here you have complete example: from...
ODIS General Coding Help 8 5,247 Sep-23-2018, 06:54 PM
    Thread: Signature verification
Post: RE: Signature verification

Can you post full example of your try including also the signature and data?
ODIS General Coding Help 8 5,247 Sep-22-2018, 09:10 PM
    Thread: Signature verification
Post: RE: Signature verification

Crypto library example: https://gist.github.com/lkdocs/6519372
ODIS General Coding Help 8 5,247 Sep-21-2018, 08:05 PM
    Thread: nested for loops glob
Post: RE: nested for loops glob

Well if you know the range of the networks, you can do it like this: import glob import os # let's iterate between number 5 and 10 for network_number in range(5, 11): # converting network numbe...
ODIS General Coding Help 3 5,125 Sep-20-2018, 09:54 PM
    Thread: nested for loops glob
Post: RE: nested for loops glob

Walking through the files in directory: import glob import os for path in glob.glob("/path/to/dir/*"): if os.path.isfile(path): print(path)You must put * to the end of the path to walk ...
ODIS General Coding Help 3 5,125 Sep-20-2018, 08:20 PM

User Panel Messages

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