workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
I put the masterlist of headers and also the current headers for the current set in a `set()`
2017-12-07T14:54:02.000130
Myong
pythondev_help_Myong_2017-12-07T14:54:02.000130
1,512,658,442.00013
102,703
pythondev
help
then I take the difference of one set minus the others
2017-12-07T14:54:13.000773
Myong
pythondev_help_Myong_2017-12-07T14:54:13.000773
1,512,658,453.000773
102,704
pythondev
help
Any chance you tried to use a dictionary?
2017-12-07T14:54:25.000179
Glinda
pythondev_help_Glinda_2017-12-07T14:54:25.000179
1,512,658,465.000179
102,705
pythondev
help
to get the headers which arent in the data set
2017-12-07T14:54:27.000221
Myong
pythondev_help_Myong_2017-12-07T14:54:27.000221
1,512,658,467.000221
102,706
pythondev
help
I am using a dictionary, yes
2017-12-07T14:54:35.000210
Myong
pythondev_help_Myong_2017-12-07T14:54:35.000210
1,512,658,475.00021
102,707
pythondev
help
When I first filter the data
2017-12-07T14:54:41.000082
Myong
pythondev_help_Myong_2017-12-07T14:54:41.000082
1,512,658,481.000082
102,708
pythondev
help
But I still have to check if the key exists in the data and if it does not I dont add a key to it for that header
2017-12-07T14:55:34.000147
Myong
pythondev_help_Myong_2017-12-07T14:55:34.000147
1,512,658,534.000147
102,709
pythondev
help
debugging right now i have one id i know is messing up
2017-12-07T14:55:46.000540
Myong
pythondev_help_Myong_2017-12-07T14:55:46.000540
1,512,658,546.00054
102,710
pythondev
help
I think I know actually what is happening
2017-12-07T14:56:29.000084
Myong
pythondev_help_Myong_2017-12-07T14:56:29.000084
1,512,658,589.000084
102,711
pythondev
help
Without seeing your data and what you want to happen, or code. It's pretty hard for me to help more.
2017-12-07T14:56:31.000069
Glinda
pythondev_help_Glinda_2017-12-07T14:56:31.000069
1,512,658,591.000069
102,712
pythondev
help
Yeah I know
2017-12-07T14:56:37.000207
Myong
pythondev_help_Myong_2017-12-07T14:56:37.000207
1,512,658,597.000207
102,713
pythondev
help
But I think I know the issue
2017-12-07T14:56:42.000411
Myong
pythondev_help_Myong_2017-12-07T14:56:42.000411
1,512,658,602.000411
102,714
pythondev
help
if there are like 3 keys
2017-12-07T14:56:45.000216
Myong
pythondev_help_Myong_2017-12-07T14:56:45.000216
1,512,658,605.000216
102,715
pythondev
help
Explain why you are using `set()` to filter?
2017-12-07T14:57:01.000334
Glinda
pythondev_help_Glinda_2017-12-07T14:57:01.000334
1,512,658,621.000334
102,716
pythondev
help
with set you can use `set1 - set2`
2017-12-07T14:57:18.000331
Myong
pythondev_help_Myong_2017-12-07T14:57:18.000331
1,512,658,638.000331
102,717
pythondev
help
so like
2017-12-07T14:57:21.000343
Myong
pythondev_help_Myong_2017-12-07T14:57:21.000343
1,512,658,641.000343
102,718
pythondev
help
set doesn't preserve order
2017-12-07T14:57:31.000685
Glinda
pythondev_help_Glinda_2017-12-07T14:57:31.000685
1,512,658,651.000685
102,719
pythondev
help
I reorder it
2017-12-07T14:58:03.000137
Myong
pythondev_help_Myong_2017-12-07T14:58:03.000137
1,512,658,683.000137
102,720
pythondev
help
with filter
2017-12-07T14:58:08.000750
Myong
pythondev_help_Myong_2017-12-07T14:58:08.000750
1,512,658,688.00075
102,721
pythondev
help
`filter()` based on index of headers
2017-12-07T14:58:17.000303
Myong
pythondev_help_Myong_2017-12-07T14:58:17.000303
1,512,658,697.000303
102,722
pythondev
help
but the issue is this
2017-12-07T14:58:19.000568
Myong
pythondev_help_Myong_2017-12-07T14:58:19.000568
1,512,658,699.000568
102,723
pythondev
help
just realize
2017-12-07T14:58:22.000153
Myong
pythondev_help_Myong_2017-12-07T14:58:22.000153
1,512,658,702.000153
102,724
pythondev
help
when inserting into a list with different size than the main header list so like inserting into a size 35 list based on indexes of size 38 list
2017-12-07T14:58:48.000332
Myong
pythondev_help_Myong_2017-12-07T14:58:48.000332
1,512,658,728.000332
102,725
pythondev
help
So if I have `[1,2,3,4,5,6,7,8,9,10]` as a main list
2017-12-07T15:00:35.000053
Myong
pythondev_help_Myong_2017-12-07T15:00:35.000053
1,512,658,835.000053
102,726
pythondev
help
Okay so if you wishto preserve order and subtract items from list_2 from list_1 this is one way you can do it: ```list_1 = [] list_2 = [] list_removed = [] for item in list_1: if not item in list_2: list_removed.append(item) ```
2017-12-07T15:00:47.000537
Glinda
pythondev_help_Glinda_2017-12-07T15:00:47.000537
1,512,658,847.000537
102,727
pythondev
help
If you wish to add a space to the list when you remove: ```list_1 = [] list_2 = [] list_removed = [] for item in list_1: if not item in list_2: list_removed.append(item) else: list_removed.append(None)```
2017-12-07T15:02:18.000096
Glinda
pythondev_help_Glinda_2017-12-07T15:02:18.000096
1,512,658,938.000096
102,728
pythondev
help
It seems mostly to be an issue when two missing cells are next to each other towards the end of the list
2017-12-07T15:03:28.000104
Myong
pythondev_help_Myong_2017-12-07T15:03:28.000104
1,512,659,008.000104
102,729
pythondev
help
and there is also a missing cell towards the beginning
2017-12-07T15:03:37.000039
Myong
pythondev_help_Myong_2017-12-07T15:03:37.000039
1,512,659,017.000039
102,730
pythondev
help
This will also work: `map(lambda x:x if not x in list_2 else None, list_1)`
2017-12-07T15:03:44.000095
Glinda
pythondev_help_Glinda_2017-12-07T15:03:44.000095
1,512,659,024.000095
102,731
pythondev
help
```>>> a = [1,2,3,4,5,5,6,7,8] >>> b = [1,7,8] >>> list(map(lambda x:x if not x in b else None, a)) [None, 2, 3, 4, 5, 5, 6, None, None]```
2017-12-07T15:06:19.000483
Glinda
pythondev_help_Glinda_2017-12-07T15:06:19.000483
1,512,659,179.000483
102,732
pythondev
help
Actually that works. forgot the not
2017-12-07T15:06:26.000357
Glinda
pythondev_help_Glinda_2017-12-07T15:06:26.000357
1,512,659,186.000357
102,733
pythondev
help
<@Myong> So you're receiving XML, and ultimately you want to build a spreadsheet with it? I'm assuming you're generating a csv file that you're opening in excel, is that right?
2017-12-07T15:16:53.000146
Harlan
pythondev_help_Harlan_2017-12-07T15:16:53.000146
1,512,659,813.000146
102,734
pythondev
help
Yes, I can do pretty much everything but there is an issue with formatting it correctly
2017-12-07T15:17:24.000148
Myong
pythondev_help_Myong_2017-12-07T15:17:24.000148
1,512,659,844.000148
102,735
pythondev
help
It seems like you're manually generating the csv yourself.
2017-12-07T15:17:31.000653
Harlan
pythondev_help_Harlan_2017-12-07T15:17:31.000653
1,512,659,851.000653
102,736
pythondev
help
It's pretty complicated to explain you can read back but for now im just debugging it
2017-12-07T15:17:50.000348
Myong
pythondev_help_Myong_2017-12-07T15:17:50.000348
1,512,659,870.000348
102,737
pythondev
help
Have you tried <https://docs.python.org/2/library/csv.html#csv.DictWriter>
2017-12-07T15:18:29.000123
Harlan
pythondev_help_Harlan_2017-12-07T15:18:29.000123
1,512,659,909.000123
102,738
pythondev
help
you can even specify a restval to fill in gaps where you don't have a value for the field.
2017-12-07T15:19:01.000104
Harlan
pythondev_help_Harlan_2017-12-07T15:19:01.000104
1,512,659,941.000104
102,739
pythondev
help
If you can get the XML into a dict, you can throw each one into a DictWriter object and it will take care of everything for you.
2017-12-07T15:19:45.000560
Harlan
pythondev_help_Harlan_2017-12-07T15:19:45.000560
1,512,659,985.00056
102,740
pythondev
help
I got it
2017-12-07T15:22:08.000296
Myong
pythondev_help_Myong_2017-12-07T15:22:08.000296
1,512,660,128.000296
102,741
pythondev
help
I think it actually worked the whole time and I looked at the wrong file :upside_down_face:
2017-12-07T15:22:24.000176
Myong
pythondev_help_Myong_2017-12-07T15:22:24.000176
1,512,660,144.000176
102,742
pythondev
help
Okay now I found the issue
2017-12-07T15:36:49.000164
Myong
pythondev_help_Myong_2017-12-07T15:36:49.000164
1,512,661,009.000164
102,743
pythondev
help
It's in deciding what order to insert the items
2017-12-07T15:37:00.000133
Myong
pythondev_help_Myong_2017-12-07T15:37:00.000133
1,512,661,020.000133
102,744
pythondev
help
<@Glinda> got it!
2017-12-07T16:05:42.000088
Cecille
pythondev_help_Cecille_2017-12-07T16:05:42.000088
1,512,662,742.000088
102,745
pythondev
help
What did you did up doing?
2017-12-07T16:07:20.000268
Glinda
pythondev_help_Glinda_2017-12-07T16:07:20.000268
1,512,662,840.000268
102,746
pythondev
help
Found a stackoverflow which pointed to a conda package called ``` nb_conda``` that you need to install
2017-12-07T16:09:34.000635
Cecille
pythondev_help_Cecille_2017-12-07T16:09:34.000635
1,512,662,974.000635
102,747
pythondev
help
Which is also in the docs butttt they don’t mention that you need to install nb_conda on the machine and the env
2017-12-07T16:10:05.000239
Cecille
pythondev_help_Cecille_2017-12-07T16:10:05.000239
1,512,663,005.000239
102,748
pythondev
help
or maybe im just a scrub, who knows. But it works!
2017-12-07T16:10:15.000178
Cecille
pythondev_help_Cecille_2017-12-07T16:10:15.000178
1,512,663,015.000178
102,749
pythondev
help
I can’t find the function definition for settimeout in <https://github.com/python/cpython/blob/3.6/Lib/socket.py>
2017-12-07T18:15:32.000028
Sabra
pythondev_help_Sabra_2017-12-07T18:15:32.000028
1,512,670,532.000028
102,750
pythondev
help
where is settimeout defined?
2017-12-07T18:15:41.000070
Sabra
pythondev_help_Sabra_2017-12-07T18:15:41.000070
1,512,670,541.00007
102,751
pythondev
help
<@Sabra> <https://github.com/python/cpython/blob/d3187158c09cf899e9849f335bdff10594209167/Modules/socketmodule.c#L2584>
2017-12-07T18:24:12.000283
Patty
pythondev_help_Patty_2017-12-07T18:24:12.000283
1,512,671,052.000283
102,752
pythondev
help
Thanks <@Patty>
2017-12-07T18:26:59.000195
Sabra
pythondev_help_Sabra_2017-12-07T18:26:59.000195
1,512,671,219.000195
102,753
pythondev
help
No problem!
2017-12-07T18:27:15.000245
Patty
pythondev_help_Patty_2017-12-07T18:27:15.000245
1,512,671,235.000245
102,754
pythondev
help
Guys in python lists there is a method called insert ,can someone clarify can it insert or single element or multiple elements in to the list ?
2017-12-07T19:27:17.000042
Bette
pythondev_help_Bette_2017-12-07T19:27:17.000042
1,512,674,837.000042
102,755
pythondev
help
`list.extend()` can take an iterable and add all of that to the list, <@Bette>
2017-12-07T19:34:30.000095
Patty
pythondev_help_Patty_2017-12-07T19:34:30.000095
1,512,675,270.000095
102,756
pythondev
help
<https://docs.python.org/3.6/tutorial/datastructures.html#more-on-lists>
2017-12-07T19:34:45.000217
Patty
pythondev_help_Patty_2017-12-07T19:34:45.000217
1,512,675,285.000217
102,757
pythondev
help
an extend with an index is a bit trickier to do but also possible
2017-12-07T19:39:06.000299
Marcie
pythondev_help_Marcie_2017-12-07T19:39:06.000299
1,512,675,546.000299
102,758
pythondev
help
```&gt;&gt;&gt; base_list = ['a', 'b', 'c', 'd'] &gt;&gt;&gt; insert_0_list = ['1', '2', '3'] &gt;&gt;&gt; [base_list.insert(1, item) for item in reversed(insert_0_list)] [None, None, None] &gt;&gt;&gt; base_list ['a', '1', '2', '3', 'b', 'c', 'd']```
2017-12-07T19:39:48.000163
Marcie
pythondev_help_Marcie_2017-12-07T19:39:48.000163
1,512,675,588.000163
102,759
pythondev
help
@joe it will allow single argument like append or multiple argument like extend that's my question,hope you got it
2017-12-07T19:44:08.000191
Bette
pythondev_help_Bette_2017-12-07T19:44:08.000191
1,512,675,848.000191
102,760
pythondev
help
single argument
2017-12-07T19:44:24.000077
Marcie
pythondev_help_Marcie_2017-12-07T19:44:24.000077
1,512,675,864.000077
102,761
pythondev
help
Thanks Johnson :+1:
2017-12-07T19:44:37.000267
Bette
pythondev_help_Bette_2017-12-07T19:44:37.000267
1,512,675,877.000267
102,762
pythondev
help
So im not sure if im doing it wrong or just not understanding but how do you make a server using asyncio? I dont get how you write the web handlers
2017-12-07T20:56:53.000108
Toby
pythondev_help_Toby_2017-12-07T20:56:53.000108
1,512,680,213.000108
102,763
pythondev
help
you would need to use the equivalent of something like requests which is aiohttp.
2017-12-07T21:02:16.000131
Johana
pythondev_help_Johana_2017-12-07T21:02:16.000131
1,512,680,536.000131
102,764
pythondev
help
i also think requests now supports asyncio.
2017-12-07T21:02:34.000137
Johana
pythondev_help_Johana_2017-12-07T21:02:34.000137
1,512,680,554.000137
102,765
pythondev
help
let me find a link.
2017-12-07T21:02:45.000186
Johana
pythondev_help_Johana_2017-12-07T21:02:45.000186
1,512,680,565.000186
102,766
pythondev
help
Like in node and express you use app.get/app.post then the url after the server url, isnt there a sinple way to do this in python?
2017-12-07T21:03:10.000045
Toby
pythondev_help_Toby_2017-12-07T21:03:10.000045
1,512,680,590.000045
102,767
pythondev
help
I find <#C0LN2AD7T|flask> to be the most express-esque python server
2017-12-07T21:09:54.000131
Patty
pythondev_help_Patty_2017-12-07T21:09:54.000131
1,512,680,994.000131
102,768
pythondev
help
Well their home page is nice haha, looks very node/express-y
2017-12-07T21:11:17.000153
Toby
pythondev_help_Toby_2017-12-07T21:11:17.000153
1,512,681,077.000153
102,769
pythondev
help
<@Tangela> when you use the `with cursor` context manager it closes the cursor after the code block
2017-12-07T21:12:48.000206
Patty
pythondev_help_Patty_2017-12-07T21:12:48.000206
1,512,681,168.000206
102,770
pythondev
help
so you need to move all `cursor.execute()` statements to be within that context manager
2017-12-07T21:13:38.000167
Patty
pythondev_help_Patty_2017-12-07T21:13:38.000167
1,512,681,218.000167
102,771
pythondev
help
Thanks @joe worked perfectly
2017-12-07T21:17:03.000073
Tangela
pythondev_help_Tangela_2017-12-07T21:17:03.000073
1,512,681,423.000073
102,772
pythondev
help
<@Patty> :taco:
2017-12-07T21:17:40.000086
Winnifred
pythondev_help_Winnifred_2017-12-07T21:17:40.000086
1,512,681,460.000086
102,773
pythondev
help
thanks <@Winnifred> :slightly_smiling_face:
2017-12-07T21:17:57.000176
Patty
pythondev_help_Patty_2017-12-07T21:17:57.000176
1,512,681,477.000176
102,774
pythondev
help
(you beat me to the answer)
2017-12-07T21:18:09.000228
Winnifred
pythondev_help_Winnifred_2017-12-07T21:18:09.000228
1,512,681,489.000228
102,775
pythondev
help
:stuck_out_tongue:
2017-12-07T21:18:13.000112
Winnifred
pythondev_help_Winnifred_2017-12-07T21:18:13.000112
1,512,681,493.000112
102,776
pythondev
help
<@Patty> any help on running flask? Haha Their example on how to run it doesnt work
2017-12-07T21:18:31.000089
Toby
pythondev_help_Toby_2017-12-07T21:18:31.000089
1,512,681,511.000089
102,777
pythondev
help
sure I can help, let’s take it to <#C0LN2AD7T|flask> to be in the right channel
2017-12-07T21:19:17.000057
Patty
pythondev_help_Patty_2017-12-07T21:19:17.000057
1,512,681,557.000057
102,778
pythondev
help
What exceptions are you worried about?
2017-12-07T22:24:39.000089
Glinda
pythondev_help_Glinda_2017-12-07T22:24:39.000089
1,512,685,479.000089
102,779
pythondev
help
string too long and invalid chars...
2017-12-07T22:28:09.000059
Tangela
pythondev_help_Tangela_2017-12-07T22:28:09.000059
1,512,685,689.000059
102,780
pythondev
help
You kind of have a lot of things happening in this single statement.
2017-12-07T22:36:36.000041
Glinda
pythondev_help_Glinda_2017-12-07T22:36:36.000041
1,512,686,196.000041
102,781
pythondev
help
What do you want to happen when you encounter 1. string too long, and 2. invalid chars?
2017-12-07T22:37:21.000162
Glinda
pythondev_help_Glinda_2017-12-07T22:37:21.000162
1,512,686,241.000162
102,782
pythondev
help
Also can you paste the code here, I'd rather not retype most of it the images are helpful.
2017-12-07T22:40:40.000105
Glinda
pythondev_help_Glinda_2017-12-07T22:40:40.000105
1,512,686,440.000105
102,783
pythondev
help
1. When encounter a string too long I want inform the user that string is too long for store it on db, 2. The user cannot store on column emails invalid characters like /, *,&amp;, %, etc.
2017-12-07T22:44:38.000202
Tangela
pythondev_help_Tangela_2017-12-07T22:44:38.000202
1,512,686,678.000202
102,784
pythondev
help
Are you using python &lt; 2.7
2017-12-07T22:54:00.000011
Glinda
pythondev_help_Glinda_2017-12-07T22:54:00.000011
1,512,687,240.000011
102,785
pythondev
help
I'm using 2.7
2017-12-07T22:56:21.000131
Tangela
pythondev_help_Tangela_2017-12-07T22:56:21.000131
1,512,687,381.000131
102,786
pythondev
help
Okay
2017-12-07T22:56:23.000137
Glinda
pythondev_help_Glinda_2017-12-07T22:56:23.000137
1,512,687,383.000137
102,787
pythondev
help
So I split your system into three parts.
2017-12-07T22:56:39.000188
Glinda
pythondev_help_Glinda_2017-12-07T22:56:39.000188
1,512,687,399.000188
102,788
pythondev
help
So now you have a single location where you might have an exception `db_cursor.execute('INSERT INTO {table_name}s({table_name}) VALUES {row}'.format(table_name=table_name, row=row))`
2017-12-07T23:00:07.000019
Glinda
pythondev_help_Glinda_2017-12-07T23:00:07.000019
1,512,687,607.000019
102,789
pythondev
help
Thank you very much <@Glinda> I was using try..except in everywhere but with your code was reduced to 3 at least
2017-12-07T23:02:37.000047
Tangela
pythondev_help_Tangela_2017-12-07T23:02:37.000047
1,512,687,757.000047
102,790
pythondev
help
You know, I don't think you need the `cursor.close()`
2017-12-07T23:03:00.000116
Glinda
pythondev_help_Glinda_2017-12-07T23:03:00.000116
1,512,687,780.000116
102,791
pythondev
help
Couple of things: 1. Don't use user=root, pw = '' set your password to something if you must use root.
2017-12-07T23:03:50.000175
Glinda
pythondev_help_Glinda_2017-12-07T23:03:50.000175
1,512,687,830.000175
102,792
pythondev
help
2. Try to define functions and make them reusable
2017-12-07T23:04:04.000046
Glinda
pythondev_help_Glinda_2017-12-07T23:04:04.000046
1,512,687,844.000046
102,793
pythondev
help
Make your functions do as limited as possible
2017-12-07T23:04:29.000152
Glinda
pythondev_help_Glinda_2017-12-07T23:04:29.000152
1,512,687,869.000152
102,794
pythondev
help
The more they do, the harder it is to debug.
2017-12-07T23:04:39.000159
Glinda
pythondev_help_Glinda_2017-12-07T23:04:39.000159
1,512,687,879.000159
102,795
pythondev
help
A bunch more things I can suggest. But primarily, try and use python 3, and try and use a ORM like sqlalchemy.
2017-12-07T23:07:00.000037
Glinda
pythondev_help_Glinda_2017-12-07T23:07:00.000037
1,512,688,020.000037
102,796
pythondev
help
If you're just getting into python, it's better to start off with python 3.
2017-12-07T23:07:30.000093
Glinda
pythondev_help_Glinda_2017-12-07T23:07:30.000093
1,512,688,050.000093
102,797
pythondev
help
Anyways, feel free to ask any more questions, or more help. I'll be around here for a little while longer tonight.
2017-12-07T23:08:41.000109
Glinda
pythondev_help_Glinda_2017-12-07T23:08:41.000109
1,512,688,121.000109
102,798
pythondev
help
I see, from now on I will write more generic functions, I usually don't do that, later I got lost in the errors, py2.7 should be discontinued so maybe better try the most actual, there huge differences between it?
2017-12-07T23:09:49.000180
Tangela
pythondev_help_Tangela_2017-12-07T23:09:49.000180
1,512,688,189.00018
102,799
pythondev
help
Probably the biggest thing you'll notice is in python3 print is a function `print('string')`
2017-12-07T23:32:41.000158
Glinda
pythondev_help_Glinda_2017-12-07T23:32:41.000158
1,512,689,561.000158
102,800
pythondev
help
hi guys. a ver beginner question. considering this piece of code, that should sort an array of strings by their length ```def sort_by_length(arr): return sorted((a for a in arr), key=(len(a) for a in arr))```the 3.6 compiler tells me : `Traceback: in &lt;module&gt; in sort_by_length TypeError: 'generator...
2017-12-08T01:37:18.000058
Blaine
pythondev_help_Blaine_2017-12-08T01:37:18.000058
1,512,697,038.000058
102,801
pythondev
help
The `key` should be a function. <https://docs.python.org/3/howto/sorting.html#key-functions> might help you.
2017-12-08T01:45:08.000212
Gisele
pythondev_help_Gisele_2017-12-08T01:45:08.000212
1,512,697,508.000212
102,802