The same way you would add any other object.
myDict = {}
myDict[“myList”] = []
That would add an empty list, whose key is “myList”, to the dictionary “myDict”.
You could also use the dict “update” method, as follows:
myDict.update( myList: [] )
or this way:
myDict.update( {‘myList’: []} )
Although the second method is more appropriate to add...
User Profile
Collapse
-
Whenever Python exists, especially those Python modules which are having circular references to other objects or the objects that are referenced from the global namespaces are not always de-allocated or freed.
It is impossible to de-allocate those portions of memory that are reserved by the C library.
On exit, because of having its own efficient cleanup mechanism, Python would try to de-allocate/destroy every other object.
So,...Leave a comment:
-
generate data into python
Python is very much matured programming language - having support to connect and fetch data from almost any type of systems (include Crystal data, Database, internet etc).
To automate - I guess you are talking about running certain programs to execute and retrieve data at particular times. You can either develop “daemons” using Python Programming or You can schedule your task (developed...Leave a comment:
-
Just import it as you import any other file in python. There is a csv module inbuilt in python, and you can use it to read, write csv files.
See this code below.
import csv
with open("data.csv" , 'r') as csvfile:
reader = csv.reader(csvf ile)
for row in reader:
print(row)
It is very simple in python.Leave a comment:
-
sritaa replied to Can we display the path of a file in python console if we selected that file manuallyin PythonSure you can. The beauty of the command line is that it does exactly what you say to do. If you say
python my_file.txt
The file my_file.txt will be executed by the Python interpreter. On GUI systems, file types determine what happens when you double-click a file, or maybe what is suggested to you to open in a program (Microsoft Word greys out anything that isn't a .doc or .docx for example).
But on the command...Leave a comment:
No activity results to display
Show More
Leave a comment: