Python Forum
How to read module/class from list of strings?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to read module/class from list of strings?
#1
How can I get 'string_wrong' to print out what 'correct' is printing out?

from google.cloud import bigquery

corret = [bigquery.SchemaField("field1","STRING", mode="NULLABLE"),
bigquery.SchemaField("field2","STRING", mode="NULLABLE")]

string_wrong = ['bigquery.SchemaField("field1","STRING", mode="NULLABLE")',
'bigquery.SchemaField("field2","STRING", mode="NULLABLE")']

print(corret)
print(string_wrong)
correct output:
Output:
[SchemaField('field1', 'STRING', 'NULLABLE', None, None, (), None), SchemaField('field2', 'STRING', 'NULLABLE', None, None, (), None)]
string_wrong output:
Output:
['bigquery.SchemaField("field1","STRING", mode="NULLABLE")', 'bigquery.SchemaField("field2","STRING", mode="NULLABLE")']
Reply


Messages In This Thread
How to read module/class from list of strings? - by popular_dog - Oct-04-2023, 02:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PyYAML read list of int zisco 2 361 Apr-02-2024, 12:36 PM
Last Post: zisco
  Trying to understand strings and lists of strings Konstantin23 2 816 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  problem in using int() with a list of strings akbarza 4 756 Jul-19-2023, 06:46 PM
Last Post: deanhystad
  Delete strings from a list to create a new only number list Dvdscot 8 1,594 May-01-2023, 09:06 PM
Last Post: deanhystad
  Help with Logical error processing List of strings dmc8300 3 1,118 Nov-27-2022, 04:10 PM
Last Post: Larz60+
  My code displays too much output when importing class from a module lil_e 4 1,195 Oct-22-2022, 12:56 AM
Last Post: Larz60+
  read a text file, find all integers, append to list oldtrafford 12 3,715 Aug-11-2022, 08:23 AM
Last Post: Pedroski55
Question How to move a class to a custom module? python300 4 1,601 Mar-08-2022, 09:19 PM
Last Post: python300
  Splitting strings in list of strings jesse68 3 1,818 Mar-02-2022, 05:15 PM
Last Post: DeaD_EyE
  Class-Aggregation and creating a list/dictionary IoannisDem 1 1,952 Oct-03-2021, 05:16 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

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