I have a main project and body. It creates a file containing the name of the country and the population in the form of a list. For ex-Armenia=[32,43,54,65,71]. How do I get the list from this file to plot it on a graph on the main program? I tried using ‘for file in open(‘Pop2020.py’,’r’):’ but ..
Assume that I have a list of file like this: abc_name.txt def_name.txt ghj_name.txt abcdefghj.txt xyz.txt I knew how to read latest file by using max(list_of_files, key=os.path.getmtime), but it could be any last created file. I want to read file that contains ‘name’ in its name and this file was last created (for example "def_name.txt"). How ..
I want to read integers in a file using Python. There are some solutions but it does not work in my case. My file looks like this 50:32 9 5 436 475 3453 40:53 63 634 26 62 44:545 63 6246 6344 6346 44 90:52 6346 65 634 63 I tried this code for line ..
I am trying to read an excel file into a dataframe using pandas and jupyter notebook from subfolder on my desktop. The file is on my desktop in a folder called ‘Data’, subfolder ‘KN-Data’, subfolder ‘New-Files’, file name "Customers.xlsx". Here is the code I am trying: df_customers = pd.read_excel (r"C:/Users/Zach/Desktop/Data/KN-Data/New-Files/Customers.xlsx") Error is [Errno 2] No ..
I ran the following code in Python: def translateDesc(fileName): textFile = open("fileName", "r") fileLines = textFile.readlines() return fileLines And the function returns an empty string. However, when I ran the lines one by one in the iPython terminals, the function returned was not empty. How should I fix this issue? Source: Python..
my folder stemming contains 7 files and each file contains no. of document but my problem is permission denied. I want to calculate the probability of each file which it is probability of files = count of thatfile / number_of_docs stemming = ‘C:/Users/user/Desktop/Akhbarona’ with open(stemming, "r", encoding="utf-8") as auto: Source: Python..
I have a very long list of possible websites. These are similar to www.a.com www.b.com www.c.com www.d.com www.e.com …… et cetera I have nearly half a million possible websites. These are stored in a text file, with each possible on a separate line (and no blank lines – I have had to put blank lines ..
I have two python snippets: file = open("text.txt", "r") leng = len(file.read().splitlines()) file.close() and file = open("text.txt", "r") print(file.readline()) file.close() They work separately, but when I put on before the other on the same piece of code, the second snippet returns nothing, even though there is still a piece of text on the selected line ..
so I’m new to multi-threading in python. I use thread pool executor to read big data files at the same time and combine them into one. I want to delete duplicate lines but to do this I need to wait for the threads to be finished right? I tried many different approaches finding here but ..