All Questions
15 questions
2
votes
1
answer
64
views
Appending a different dataset to ONE list every iteration
In my current code I'm iterating through 4500 cell values of a column from an excel file. In each iteration, the cell value is added between two halves of an invalid URL to form a valid URL. I can ...
0
votes
1
answer
182
views
Append dict at same time python
I want to append elements to an empty dictionary in python.
For a current frame I am attributing two keys: 'ID' and 'Coordinates'.
My problem is when I am appending the values, e.g
df={}
for i in ...
-3
votes
2
answers
1k
views
how append (key,value) with loop on python
I want to create a new dict with a loop but I don't find the way to push key and value in loop with append. I try something like this but I'm still searching the good way.
frigo = {"mangue" :...
1
vote
2
answers
50
views
How to append two dictionaries using user input but the second dictionary should be the value and First dictionary should be key
no_sub = int(input("Enter Number Of Subjects : "))`
no_mark = int(input("Enter how many student's marks do you want to add : "))
for i in range (0,no_sub):
sub_name = input(&...
-1
votes
2
answers
61
views
Python Iterating Through List and Appending Values to Key
I got this loop where it iterates through list_one that contains the key "id" nested inside "groups".
The other list_two also contains the key "id" but is not nested. The ...
0
votes
1
answer
245
views
Update a csv with dict values in a loop without keys
I can make a csv with from a dict ok using csv.Dictwriter but cannot figure out how to make a function to append a new dicts values to the csv file and ensuring that a value is added to the correct ...
0
votes
1
answer
355
views
Writing values from dictionary object to text file only writing last key value pair
I don't know C# or any programming that well at all, but I want to learn. I've been searching online last couple days to put together what is supposed to read from 2 text files and output a file (...
4
votes
5
answers
6k
views
Iterate through Python dictionary and special append to new list?
I would like to iterate over a dictionary, and append each key (letter) repeated by the number of times of its value (frequency) to a new list.
For example:
input: {'A':1, 'B':2}. Expected output: [...
1
vote
3
answers
1k
views
Python for loop appends only the last list as value
I am looping through a directory and want to get all files in a folder stored as list in a dictionary, where each key is a folder and the list of files the value.
The first print in the loop shows ...
1
vote
2
answers
144
views
Append elements to multiple keys of a Python dictionary
I am trying to append elements to multiple dictionary keys in a loop. However, right now i see only a long way to do this - separate line for every key update, for example:
# My dictionary
my_dict = {...
0
votes
2
answers
83
views
Appending into a dictionary within a loop - strange behavior
This might sound banal but it has being a pain.
So I wrote code that parses lines. The .txt file has a line which match my re.match and a line which doesnt.
cat file.txt
00.00.00 : Blabla
x
In ...
1
vote
0
answers
43
views
Append Open List from Dictionary
I have created a csv file containing zip codes and corresponding vendors in those zip codes.
CSV File Image
Download CSV:
https://www.dropbox.com/s/8hm6yvy9gviydcv/us_postal_codes.csv?dl=0
I wrote ...
1
vote
0
answers
18
views
How to append the updated value every time?
I am using loops to append a new value, but in the result, it adds the updated value several times.
Here are my codes:
TWqs=[]
d=3
for d in range(d):
tmpp=tmp[(tmp['date'] == dates[d])]
qs=...
0
votes
1
answer
237
views
Combine elements in list of Tuples?
I'm working on a program that takes in an imdb text file, and outputs the top actors (by movie appearances) based on the user input N.
However, I'm running into an issue where I'm having slots taken ...
0
votes
3
answers
1k
views
Append a dictionary key to a list depending on the value of the key
While iterating in a for loop, I am trying to append a dictionary item's key to a list if the item has a value of 1.
What I have is:
peeps = {'scoobydoo':0, 'shaggy':0, 'scrappydoo':0, 'velma':1, '...