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
ok, but len is a build_in? i will read and contemplate.
2017-12-08T01:52:03.000217
Blaine
pythondev_help_Blaine_2017-12-08T01:52:03.000217
1,512,697,923.000217
102,803
pythondev
help
thank you <@Gisele> i've learned a lot on this. Solution is very compact ```def length(word): return len(word) def sort_by_length(arr): return sorted(arr, key=length)```
2017-12-08T02:14:32.000246
Blaine
pythondev_help_Blaine_2017-12-08T02:14:32.000246
1,512,699,272.000246
102,804
pythondev
help
even shorter with this
2017-12-08T02:15:35.000196
Blaine
pythondev_help_Blaine_2017-12-08T02:15:35.000196
1,512,699,335.000196
102,805
pythondev
help
```def sort_by_length(arr): return sorted(arr, key=lambda x: len(x)) ````
2017-12-08T02:15:41.000100
Blaine
pythondev_help_Blaine_2017-12-08T02:15:41.000100
1,512,699,341.0001
102,806
pythondev
help
yes, len() is built in.
2017-12-08T02:15:54.000037
Gisele
pythondev_help_Gisele_2017-12-08T02:15:54.000037
1,512,699,354.000037
102,807
pythondev
help
this may be a spoiler, but ```def sort_by_length(arr): return sorted(arr, key=len)``` is shoter a bit.
2017-12-08T02:17:53.000214
Gisele
pythondev_help_Gisele_2017-12-08T02:17:53.000214
1,512,699,473.000214
102,808
pythondev
help
argh, i see, even shorter and also more intuitve. sometimes i think way to complicated
2017-12-08T02:21:59.000101
Blaine
pythondev_help_Blaine_2017-12-08T02:21:59.000101
1,512,699,719.000101
102,809
pythondev
help
thanks for your attention. may the code be with you :slightly_smiling_face:
2017-12-08T02:22:14.000001
Blaine
pythondev_help_Blaine_2017-12-08T02:22:14.000001
1,512,699,734.000001
102,810
pythondev
help
Hey everyone. How get number from this string in python 2.7 ```print u'\u517145\u9875' 共45页```
2017-12-08T05:07:17.000519
Georgeann
pythondev_help_Georgeann_2017-12-08T05:07:17.000519
1,512,709,637.000519
102,811
pythondev
help
number for this string? :confused:
2017-12-08T05:07:44.000072
Suellen
pythondev_help_Suellen_2017-12-08T05:07:44.000072
1,512,709,664.000072
102,812
pythondev
help
*from
2017-12-08T05:08:01.000465
Georgeann
pythondev_help_Georgeann_2017-12-08T05:08:01.000465
1,512,709,681.000465
102,813
pythondev
help
``` &gt;&gt;&gt; for c in s: ... print(c, c.isdigit()) ... (u'\u5171', False) (u'4', True) (u'5', True) (u'\u9875', False) ```
2017-12-08T05:08:40.000313
Suellen
pythondev_help_Suellen_2017-12-08T05:08:40.000313
1,512,709,720.000313
102,814
pythondev
help
Remove trailing non-digits
2017-12-08T05:08:50.000256
Suellen
pythondev_help_Suellen_2017-12-08T05:08:50.000256
1,512,709,730.000256
102,815
pythondev
help
Join what's left and convert to an int
2017-12-08T05:09:07.000469
Suellen
pythondev_help_Suellen_2017-12-08T05:09:07.000469
1,512,709,747.000469
102,816
pythondev
help
Works for simple cases only, and won't work for "aa10bb15"
2017-12-08T05:09:32.000141
Suellen
pythondev_help_Suellen_2017-12-08T05:09:32.000141
1,512,709,772.000141
102,817
pythondev
help
thanks
2017-12-08T05:13:56.000297
Georgeann
pythondev_help_Georgeann_2017-12-08T05:13:56.000297
1,512,710,036.000297
102,818
pythondev
help
Anyone using Rollbar for logging in Django and passing in `extra` when using Pythons logging module rather than `rollbar.`
2017-12-08T07:46:48.000272
Temika
pythondev_help_Temika_2017-12-08T07:46:48.000272
1,512,719,208.000272
102,819
pythondev
help
Hello, I'm new to Python and I'm trying to find some data with a regular expression. Does anyone have any idea why this does not match? ``` regex = r'(?&lt;=Travis )CI' match = re.match(regex, 'Travis CI') ```
2017-12-08T07:47:59.000031
Ashlea
pythondev_help_Ashlea_2017-12-08T07:47:59.000031
1,512,719,279.000031
102,820
pythondev
help
try search instead of match
2017-12-08T08:01:42.000293
Lachelle
pythondev_help_Lachelle_2017-12-08T08:01:42.000293
1,512,720,102.000293
102,821
pythondev
help
for match, pattern must match from the beginning of string
2017-12-08T08:02:27.000106
Lachelle
pythondev_help_Lachelle_2017-12-08T08:02:27.000106
1,512,720,147.000106
102,822
pythondev
help
<@Lachelle> Thanks, that worked. :slightly_smiling_face:
2017-12-08T08:14:58.000427
Ashlea
pythondev_help_Ashlea_2017-12-08T08:14:58.000427
1,512,720,898.000427
102,823
pythondev
help
Hi guys. I am working with Celery, and it’s pretty cool. However, I would need a way to communicate with my application and I was thinking of nameko due to the wide range of communication protocols.
2017-12-08T09:22:40.000087
Jacki
pythondev_help_Jacki_2017-12-08T09:22:40.000087
1,512,724,960.000087
102,824
pythondev
help
I am still in the learning mode, so I am not sure if it is a good idea or not
2017-12-08T09:22:57.000052
Jacki
pythondev_help_Jacki_2017-12-08T09:22:57.000052
1,512,724,977.000052
102,825
pythondev
help
how do you usually provide your application with a communication layer
2017-12-08T09:23:45.000520
Jacki
pythondev_help_Jacki_2017-12-08T09:23:45.000520
1,512,725,025.00052
102,826
pythondev
help
that can be rpc or pub/sub?
2017-12-08T09:23:57.000617
Jacki
pythondev_help_Jacki_2017-12-08T09:23:57.000617
1,512,725,037.000617
102,827
pythondev
help
From what I know most of the times people try to use redis to store celery result
2017-12-08T09:30:43.000263
Ciera
pythondev_help_Ciera_2017-12-08T09:30:43.000263
1,512,725,443.000263
102,828
pythondev
help
Or rabbitmq, those are probably the 2 big backends
2017-12-08T09:33:34.000628
Patty
pythondev_help_Patty_2017-12-08T09:33:34.000628
1,512,725,614.000628
102,829
pythondev
help
oh yes, if you need to store results you can use a few backends service. However, my questions is about the integration of the two project.
2017-12-08T09:36:50.000079
Jacki
pythondev_help_Jacki_2017-12-08T09:36:50.000079
1,512,725,810.000079
102,830
pythondev
help
Let say that the main business logic of the workers is made with celery.
2017-12-08T09:37:23.000321
Jacki
pythondev_help_Jacki_2017-12-08T09:37:23.000321
1,512,725,843.000321
102,831
pythondev
help
but I need to expose a public api
2017-12-08T09:37:37.000368
Jacki
pythondev_help_Jacki_2017-12-08T09:37:37.000368
1,512,725,857.000368
102,832
pythondev
help
and I don’t want to use flask or some other REST api
2017-12-08T09:37:50.000030
Jacki
pythondev_help_Jacki_2017-12-08T09:37:50.000030
1,512,725,870.00003
102,833
pythondev
help
oh well, I would like to use something different than that
2017-12-08T09:38:04.000437
Jacki
pythondev_help_Jacki_2017-12-08T09:38:04.000437
1,512,725,884.000437
102,834
pythondev
help
something more message oriented.
2017-12-08T09:38:17.000166
Jacki
pythondev_help_Jacki_2017-12-08T09:38:17.000166
1,512,725,897.000166
102,835
pythondev
help
I am not sure if combine together the functionalities of nameko and the logic of celery is a good catch or a bad idea
2017-12-08T09:38:43.000363
Jacki
pythondev_help_Jacki_2017-12-08T09:38:43.000363
1,512,725,923.000363
102,836
pythondev
help
you want to expose an API over the network other than HTTP ?
2017-12-08T09:47:00.000708
Ciera
pythondev_help_Ciera_2017-12-08T09:47:00.000708
1,512,726,420.000708
102,837
pythondev
help
nameko seems to be over http or AMQP
2017-12-08T09:48:45.000078
Ciera
pythondev_help_Ciera_2017-12-08T09:48:45.000078
1,512,726,525.000078
102,838
pythondev
help
yes. I am trying to integrate it with AMQP
2017-12-08T09:51:14.000104
Jacki
pythondev_help_Jacki_2017-12-08T09:51:14.000104
1,512,726,674.000104
102,839
pythondev
help
Hi .. how to iterate over json stream.. to prient both key and value for all the items in the json steam.. pls help me on this
2017-12-08T09:57:22.000500
Alexa
pythondev_help_Alexa_2017-12-08T09:57:22.000500
1,512,727,042.0005
102,840
pythondev
help
And I need to help for reading data from xml stream also ..
2017-12-08T09:58:14.000385
Alexa
pythondev_help_Alexa_2017-12-08T09:58:14.000385
1,512,727,094.000385
102,841
pythondev
help
Here is the full info ...
2017-12-08T10:09:23.000248
Alexa
pythondev_help_Alexa_2017-12-08T10:09:23.000248
1,512,727,763.000248
102,842
pythondev
help
I am trying fetch the configuration from Jenkins api .. using python-jenkin module.. I got the xml output .. now I need to convert this to readable formate like key value in the print screen.. I tried convert the xml stream to json stream using xmltojson module .. after that I got the json steam ... But when I try to ...
2017-12-08T10:09:26.000247
Alexa
pythondev_help_Alexa_2017-12-08T10:09:26.000247
1,512,727,766.000247
102,843
pythondev
help
<@Alexa> you are probably missing a conversion from json string to dict
2017-12-08T10:16:05.000414
Wade
pythondev_help_Wade_2017-12-08T10:16:05.000414
1,512,728,165.000414
102,844
pythondev
help
json.loads(your_str)
2017-12-08T10:16:22.000047
Wade
pythondev_help_Wade_2017-12-08T10:16:22.000047
1,512,728,182.000047
102,845
pythondev
help
I have that in my code ...
2017-12-08T10:16:40.000192
Alexa
pythondev_help_Alexa_2017-12-08T10:16:40.000192
1,512,728,200.000192
102,846
pythondev
help
A = json.loads(json.dump(xmltodict.parse(xmlstream))) this my conversation code
2017-12-08T10:19:37.000520
Alexa
pythondev_help_Alexa_2017-12-08T10:19:37.000520
1,512,728,377.00052
102,847
pythondev
help
After this I am trying to iterate using for loop
2017-12-08T10:20:02.000364
Alexa
pythondev_help_Alexa_2017-12-08T10:20:02.000364
1,512,728,402.000364
102,848
pythondev
help
<@Jacki> i don't know if i understood your question. Are you worried about using nameko and celery in your service, because both are over AMQP protocol?
2017-12-08T10:22:36.000672
Wade
pythondev_help_Wade_2017-12-08T10:22:36.000672
1,512,728,556.000672
102,849
pythondev
help
<@Alexa> why are you converting to json when you alreayd have xml to dict conversion?
2017-12-08T10:23:29.000247
Meg
pythondev_help_Meg_2017-12-08T10:23:29.000247
1,512,728,609.000247
102,850
pythondev
help
<@Alexa> could you post the code here as pyhon snippet? And yeah, loads after dumps is nosense.
2017-12-08T10:24:03.000326
Wade
pythondev_help_Wade_2017-12-08T10:24:03.000326
1,512,728,643.000326
102,851
pythondev
help
<@Meg> i am not able extract data from dict.. also
2017-12-08T10:24:25.000602
Alexa
pythondev_help_Alexa_2017-12-08T10:24:25.000602
1,512,728,665.000602
102,852
pythondev
help
if I read your code right, you’re converting xml to a dict, then to json string, then load that string it as a dict
2017-12-08T10:24:25.000612
Meg
pythondev_help_Meg_2017-12-08T10:24:25.000612
1,512,728,665.000612
102,853
pythondev
help
what do you get when you do `type(xmltodict.parse(stream))`?
2017-12-08T10:25:26.000573
Meg
pythondev_help_Meg_2017-12-08T10:25:26.000573
1,512,728,726.000573
102,854
pythondev
help
<@Meg> let me check
2017-12-08T10:25:46.000109
Alexa
pythondev_help_Alexa_2017-12-08T10:25:46.000109
1,512,728,746.000109
102,855
pythondev
help
that should be a dict
2017-12-08T10:27:01.000308
Wade
pythondev_help_Wade_2017-12-08T10:27:01.000308
1,512,728,821.000308
102,856
pythondev
help
<https://github.com/martinblech/xmltodict>
2017-12-08T10:27:07.000192
Wade
pythondev_help_Wade_2017-12-08T10:27:07.000192
1,512,728,827.000192
102,857
pythondev
help
<@Meg> i am getting OrderedDict ([(....
2017-12-08T10:28:37.000229
Alexa
pythondev_help_Alexa_2017-12-08T10:28:37.000229
1,512,728,917.000229
102,858
pythondev
help
ok, that’s a dict there
2017-12-08T10:28:54.000203
Meg
pythondev_help_Meg_2017-12-08T10:28:54.000203
1,512,728,934.000203
102,859
pythondev
help
so how are you accessing the keys?
2017-12-08T10:29:03.000264
Meg
pythondev_help_Meg_2017-12-08T10:29:03.000264
1,512,728,943.000264
102,860
pythondev
help
<@Wade> any way to achieve this
2017-12-08T10:29:11.000424
Alexa
pythondev_help_Alexa_2017-12-08T10:29:11.000424
1,512,728,951.000424
102,861
pythondev
help
<@Alexa> btw beware: json.dump and json.dumps are quite different methods
2017-12-08T10:29:11.000757
Wade
pythondev_help_Wade_2017-12-08T10:29:11.000757
1,512,728,951.000757
102,862
pythondev
help
one relies on a file, and the other relies on a string
2017-12-08T10:29:27.000233
Meg
pythondev_help_Meg_2017-12-08T10:29:27.000233
1,512,728,967.000233
102,863
pythondev
help
<@Alexa> use this for code formatting
2017-12-08T10:29:53.000103
Meg
pythondev_help_Meg_2017-12-08T10:29:53.000103
1,512,728,993.000103
102,864
pythondev
help
<https://get.slack.help/hc/en-us/articles/202288908-Format-your-messages#code-blocks>
2017-12-08T10:29:53.000529
Meg
pythondev_help_Meg_2017-12-08T10:29:53.000529
1,512,728,993.000529
102,865
pythondev
help
because what’s appearing here is you’re doing the wrong thing with loading the data into a dict, and reading from the dict
2017-12-08T10:31:42.000307
Meg
pythondev_help_Meg_2017-12-08T10:31:42.000307
1,512,729,102.000307
102,866
pythondev
help
'for i in A.items():'
2017-12-08T10:39:19.000146
Alexa
pythondev_help_Alexa_2017-12-08T10:39:19.000146
1,512,729,559.000146
102,867
pythondev
help
and then?
2017-12-08T10:41:39.000227
Meg
pythondev_help_Meg_2017-12-08T10:41:39.000227
1,512,729,699.000227
102,868
pythondev
help
"""for i in A: for k,v in i.item(): print(k,v)"""
2017-12-08T10:41:58.000226
Alexa
pythondev_help_Alexa_2017-12-08T10:41:58.000226
1,512,729,718.000226
102,869
pythondev
help
those are backticks, not quotes
2017-12-08T10:42:20.000535
Meg
pythondev_help_Meg_2017-12-08T10:42:20.000535
1,512,729,740.000535
102,870
pythondev
help
on the left side of the 1 key
2017-12-08T10:42:32.000402
Meg
pythondev_help_Meg_2017-12-08T10:42:32.000402
1,512,729,752.000402
102,871
pythondev
help
usually
2017-12-08T10:42:37.000207
Meg
pythondev_help_Meg_2017-12-08T10:42:37.000207
1,512,729,757.000207
102,872
pythondev
help
:smile:
2017-12-08T10:42:40.000225
Meg
pythondev_help_Meg_2017-12-08T10:42:40.000225
1,512,729,760.000225
102,873
pythondev
help
ok, there are a number of problems here
2017-12-08T10:43:18.000736
Meg
pythondev_help_Meg_2017-12-08T10:43:18.000736
1,512,729,798.000736
102,874
pythondev
help
first, you have to use `items()` for `A`, and not inside it
2017-12-08T10:43:35.000251
Meg
pythondev_help_Meg_2017-12-08T10:43:35.000251
1,512,729,815.000251
102,875
pythondev
help
it was type mistake items only there..
2017-12-08T10:44:10.000419
Alexa
pythondev_help_Alexa_2017-12-08T10:44:10.000419
1,512,729,850.000419
102,876
pythondev
help
eg ```for i in A.keys(): for k, v in i.items(): print(k, v) ```
2017-12-08T10:45:07.000592
Meg
pythondev_help_Meg_2017-12-08T10:45:07.000592
1,512,729,907.000592
102,877
pythondev
help
because you need to specify _what_ you’re trying to get from the dict
2017-12-08T10:45:28.000253
Meg
pythondev_help_Meg_2017-12-08T10:45:28.000253
1,512,729,928.000253
102,878
pythondev
help
ok
2017-12-08T10:45:37.000459
Alexa
pythondev_help_Alexa_2017-12-08T10:45:37.000459
1,512,729,937.000459
102,879
pythondev
help
lmc
2017-12-08T10:45:41.000016
Alexa
pythondev_help_Alexa_2017-12-08T10:45:41.000016
1,512,729,941.000016
102,880
pythondev
help
because its not an iterable by default
2017-12-08T10:45:43.000140
Meg
pythondev_help_Meg_2017-12-08T10:45:43.000140
1,512,729,943.00014
102,881
pythondev
help
this will fail if one of your "outer" dict values are not dict themselves
2017-12-08T10:47:04.000508
Wade
pythondev_help_Wade_2017-12-08T10:47:04.000508
1,512,730,024.000508
102,882
pythondev
help
uh wait
2017-12-08T10:47:56.000329
Wade
pythondev_help_Wade_2017-12-08T10:47:56.000329
1,512,730,076.000329
102,883
pythondev
help
<@Wade> <@Meg> not i am getting above error
2017-12-08T10:47:58.000010
Alexa
pythondev_help_Alexa_2017-12-08T10:47:58.000010
1,512,730,078.00001
102,884
pythondev
help
that doesn’t make any sense at all
2017-12-08T10:48:44.000236
Meg
pythondev_help_Meg_2017-12-08T10:48:44.000236
1,512,730,124.000236
102,885
pythondev
help
are you using `A = xmltodict(stream)`?
2017-12-08T10:48:57.000493
Meg
pythondev_help_Meg_2017-12-08T10:48:57.000493
1,512,730,137.000493
102,886
pythondev
help
in your snippet "i" is one of the keys of a dict
2017-12-08T10:49:46.000224
Wade
pythondev_help_Wade_2017-12-08T10:49:46.000224
1,512,730,186.000224
102,887
pythondev
help
and it's not possible it's a dict, because dicts are not hashable by default (probably OrderDicts are, but idk)
2017-12-08T10:51:27.000313
Wade
pythondev_help_Wade_2017-12-08T10:51:27.000313
1,512,730,287.000313
102,888
pythondev
help
(and dict keys needs to be hashable...ofc)
2017-12-08T10:54:20.000523
Wade
pythondev_help_Wade_2017-12-08T10:54:20.000523
1,512,730,460.000523
102,889
pythondev
help
<@Wade> yes, I was wondering if it is a good solution in terms of performance and design. What I would like to have is an agnostic adapter for the APIs side of the application. Moreover, I’vent found that much about nameko and AMQP. Do you have any good example how to use it with Redis or Rabbit? Thanks a lot
2017-12-08T10:54:59.000132
Jacki
pythondev_help_Jacki_2017-12-08T10:54:59.000132
1,512,730,499.000132
102,890
pythondev
help
<@Tangela> could you show what kind of data your CSV have?
2017-12-08T10:56:50.000146
Jacki
pythondev_help_Jacki_2017-12-08T10:56:50.000146
1,512,730,610.000146
102,891
pythondev
help
<@Wade> got it but it is not the key.. in dict let me ping the full code then u guys will get the clear idea ..
2017-12-08T10:57:30.000780
Alexa
pythondev_help_Alexa_2017-12-08T10:57:30.000780
1,512,730,650.00078
102,892
pythondev
help
<@Tangela> other than the error you are getting (probably because that 'row' is invalid) , there is another kind of error (a LOT worst). You are exposing your system to be SQLInjected. If someone puts in that CSV a malicious snippet of SQL code, you run it in your database :slightly_smiling_face: look at psycopg2 docs ...
2017-12-08T11:02:20.000173
Wade
pythondev_help_Wade_2017-12-08T11:02:20.000173
1,512,730,940.000173
102,893
pythondev
help
Thanks <@Wade>! going to check it
2017-12-08T11:03:36.000212
Tangela
pythondev_help_Tangela_2017-12-08T11:03:36.000212
1,512,731,016.000212
102,894
pythondev
help
<@Jacki> no, i'm sorry. I've not used celery or nameko. I only heard of them and look'd at their API some time ago
2017-12-08T11:05:10.000316
Wade
pythondev_help_Wade_2017-12-08T11:05:10.000316
1,512,731,110.000316
102,895
pythondev
help
I use celery alot, but not with nameko
2017-12-08T11:07:28.000289
Meg
pythondev_help_Meg_2017-12-08T11:07:28.000289
1,512,731,248.000289
102,896
pythondev
help
celery tasks are integrated with django apps, so I call them through regular django HTTP API calls
2017-12-08T11:07:53.000157
Meg
pythondev_help_Meg_2017-12-08T11:07:53.000157
1,512,731,273.000157
102,897
pythondev
help
Hey slackers, I started work for a new company 6 weeks ago, that is in desperate need of automation across the board.. I have been implementing python and bash scripts here and there to prove concepts and add some immediate value. I want to step this up a notch and implement some type of integration platform that I ...
2017-12-08T11:19:13.000032
Season
pythondev_help_Season_2017-12-08T11:19:13.000032
1,512,731,953.000032
102,898
pythondev
help
That won’t prevent SQL injection, you’re putting the values directly into the query without sanitizing them
2017-12-08T11:41:30.000107
Patty
pythondev_help_Patty_2017-12-08T11:41:30.000107
1,512,733,290.000107
102,899
pythondev
help
<http://bobby-tables.com/python>
2017-12-08T11:42:05.000366
Patty
pythondev_help_Patty_2017-12-08T11:42:05.000366
1,512,733,325.000366
102,900
pythondev
help
though it depends on which database module you are using
2017-12-08T11:42:34.000422
Patty
pythondev_help_Patty_2017-12-08T11:42:34.000422
1,512,733,354.000422
102,901
pythondev
help
Also, a small thing, but it’s a lot easier to share code/output on here with snippets or code formatting with backticks instead of screenshots
2017-12-08T11:44:38.000082
Patty
pythondev_help_Patty_2017-12-08T11:44:38.000082
1,512,733,478.000082
102,902