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
show your code please? it is likely something else is happening
2019-05-24T14:08:09.088200
Clemmie
pythondev_help_Clemmie_2019-05-24T14:08:09.088200
1,558,706,889.0882
25,221
pythondev
help
the code around that bit in your module
2019-05-24T14:08:19.088500
Clemmie
pythondev_help_Clemmie_2019-05-24T14:08:19.088500
1,558,706,899.0885
25,222
pythondev
help
Sounds like you may have used `dir` as a string variable earlier in the code?
2019-05-24T14:09:18.088900
Sasha
pythondev_help_Sasha_2019-05-24T14:09:18.088900
1,558,706,958.0889
25,223
pythondev
help
``` import gdb import signal print dir print signal `<module 'signal' (built-in)> <type 'module'> /usr/lib64/../share/gdb/python <type 'str'> ```
2019-05-24T14:11:55.089500
Layla
pythondev_help_Layla_2019-05-24T14:11:55.089500
1,558,707,115.0895
25,224
pythondev
help
looks like gdb is overriding the dir name
2019-05-24T14:12:09.089900
Layla
pythondev_help_Layla_2019-05-24T14:12:09.089900
1,558,707,129.0899
25,225
pythondev
help
```import signal SIGNALS_TO_NAMES_DICT = dict((getattr(signal, n), n) for n in dir(signal) if n.startswith('SIG') and '_' not in n ) import gdb ``` ugh that works
2019-05-24T14:13:07.090200
Layla
pythondev_help_Layla_2019-05-24T14:13:07.090200
1,558,707,187.0902
25,226
pythondev
help
can't run it without a core dump so maybe it's the import gdb or possibly the actual parent gdb process :disappointed:
2019-05-24T14:14:20.090900
Layla
pythondev_help_Layla_2019-05-24T14:14:20.090900
1,558,707,260.0909
25,227
pythondev
help
```import signal import gdb SIGNALS_TO_NAMES_DICT = dict((getattr(signal, n), n) for n in dir(signal) if n.startswith('SIG') and '_' not in n ) ``` that also works.
2019-05-24T14:15:13.091200
Layla
pythondev_help_Layla_2019-05-24T14:15:13.091200
1,558,707,313.0912
25,228
pythondev
help
``` # test_sig.py import gdb import signal class DirIssue(gdb.Command): def __init__(self): super (DirIssue, self).__init__("data", gdb.COMMAND_SUPPORT,gdb.COMPLETE_NONE,True) def invoke(self, arg, from_tty): print(dir) print(type(dir)) DirIssue() ``` ```> gdb executable corefile (gdb) source ~/test_sig.py (gdb) data /usr/lib64/../share/gdb/python <type 'str'> ``` no corefile ```> gdb executable (gdb) source ~/test_sig.py (gdb) data <built-in function dir> <type 'builtin_function_or_method'> ``` looks like something to do with importing gdb and then invoking the command but only when you have a coredump
2019-05-24T14:32:37.093200
Layla
pythondev_help_Layla_2019-05-24T14:32:37.093200
1,558,708,357.0932
25,229
pythondev
help
not really sure where to ask this, maybe random is better, are you guys seeing people use static typing more with python now
2019-05-24T15:56:24.094100
Caridad
pythondev_help_Caridad_2019-05-24T15:56:24.094100
1,558,713,384.0941
25,230
pythondev
help
more, yes, mostly because it s fairly new and people are still getting used to it. good/bad/useful/not? up for debate, mostly depends on the layer (library, framework, user facing)
2019-05-24T15:58:31.096000
Clemmie
pythondev_help_Clemmie_2019-05-24T15:58:31.096000
1,558,713,511.096
25,231
pythondev
help
makes sense, i could see how its arguably more useful with say javascript than python, I have always been a fan of typescript
2019-05-24T16:02:34.098300
Caridad
pythondev_help_Caridad_2019-05-24T16:02:34.098300
1,558,713,754.0983
25,232
pythondev
help
the difference between strong and weak typing systems
2019-05-24T16:02:55.098600
Hiroko
pythondev_help_Hiroko_2019-05-24T16:02:55.098600
1,558,713,775.0986
25,233
pythondev
help
I'm using it a lot more now, but most of the stuff I do isn't so clever as to confuse mypy
2019-05-24T16:27:52.099800
Bethany
pythondev_help_Bethany_2019-05-24T16:27:52.099800
1,558,715,272.0998
25,234
pythondev
help
AKA if the libraries were there I'd be using a compiled language
2019-05-24T16:28:17.100600
Bethany
pythondev_help_Bethany_2019-05-24T16:28:17.100600
1,558,715,297.1006
25,235
pythondev
help
I was trying to use typing with home build drf and django model mixins that ended up with a lot of `Option[Any,Any]->Any` and crazy useless stuff like that
2019-05-24T16:29:26.101900
Clemmie
pythondev_help_Clemmie_2019-05-24T16:29:26.101900
1,558,715,366.1019
25,236
pythondev
help
Anyone familiar with JupyterLab? In the View menu there is a Collapse All Code item. Is there a way to automatically enable this item when you Run All Cells in a notebook? Something like `%collapse` at the top of the notebook that would collapse all the code cells. :thinking_face:
2019-05-24T16:34:50.102300
Fawn
pythondev_help_Fawn_2019-05-24T16:34:50.102300
1,558,715,690.1023
25,237
pythondev
help
code '''test'''
2019-05-24T21:28:00.103800
Isabel
pythondev_help_Isabel_2019-05-24T21:28:00.103800
1,558,733,280.1038
25,238
pythondev
help
code ```
2019-05-24T21:28:29.104100
Isabel
pythondev_help_Isabel_2019-05-24T21:28:29.104100
1,558,733,309.1041
25,239
pythondev
help
code ``` test ```
2019-05-24T21:28:33.104300
Isabel
pythondev_help_Isabel_2019-05-24T21:28:33.104300
1,558,733,313.1043
25,240
pythondev
help
code1 ``` test ```
2019-05-24T21:29:05.104700
Isabel
pythondev_help_Isabel_2019-05-24T21:29:05.104700
1,558,733,345.1047
25,241
pythondev
help
winsound not importing - giving me error windows sound ``` #Simple Pong in Python 3 for Beginners import turtle import winsound window = turtle.Screen() window.title("Pong by Tyler") window.bgcolor("black") window.setup(width=800, height=600) window.tracer(0) # Score score_a = 0 score_b = 0 #Paddle A paddle_a = turtle.Turtle() paddle_a.speed(0) paddle_a.shape('square') paddle_a.color('white') paddle_a.shapesize(stretch_wid=5, stretch_len=1) paddle_a.penup() paddle_a.goto(-350, 0) #Paddle B paddle_b = turtle.Turtle() paddle_b.speed(0) paddle_b.shape('square') paddle_b.color('white') paddle_b.shapesize(stretch_wid=5, stretch_len=1) paddle_b.penup() paddle_b.goto(350, 0) # Ball ball = turtle.Turtle() ball.speed(0) ball.shape('square') ball.color('white') ball.shapesize(stretch_wid=1, stretch_len=1) ball.penup() ball.goto(0, 0) ball.dx = .15 ball.dy = .15 # Pen pen = turtle.Turtle() pen.speed(0) pen.color('white') pen.penup() pen.hideturtle() pen.goto(0,260) pen.write('Player A: 0 Player B: 0', align='center', font=('Courier', 24, 'normal') ) # Function def paddle_a_up(): y = paddle_a.ycor() y += 20 paddle_a.sety(y) def paddle_a_down(): y = paddle_a.ycor() y -= 20 paddle_a.sety(y) def paddle_b_up(): y = paddle_b.ycor() y += 20 paddle_b.sety(y) def paddle_b_down(): y = paddle_b.ycor() y -= 20 paddle_b.sety(y) #keyboard binding window.listen() window.onkeypress(paddle_a_up, "w") window.onkeypress(paddle_a_down, "s") window.onkeypress(paddle_b_up, "Up") window.onkeypress(paddle_b_down, "Down") #Main game loop while True: window.update() #move the ball ball.setx(ball.xcor() + ball.dx) ball.sety(ball.ycor() + ball.dy) #border checking if ball.ycor() > 290: ball.sety(290) ball.dy *= -1 winsound.PlaySound('bounce.wav', winsound.SND_ASYNC) if ball.ycor() < -290: ball.sety(-290) ball.dy *= -1 winsound.PlaySound('bounce.wav', winsound.SND_ASYNC) if ball.xcor() > 390: ball.goto(0, 0) ball.dx *= -1 score_a += 1 pen.clear() pen.write('Player A: {} Player B: {}'.format(score_a, score_b), align='center', font=('Courier', 24, 'normal') ) if ball.xcor() < -390: ball.goto(0, 0) ball.dx *= -1 score_b += 1 pen.clear() pen.write('Player A: {} Player B: {}'.format(score_a, score_b), align='center', font=('Courier', 24, 'normal') ) # Paddle and ball collisions if (ball.xcor() > 340 and ball.xcor() < 350) and (ball.ycor() < paddle_b.ycor() + 40 and ball.ycor() > paddle_b.ycor() -40): ball.setx(340) ball.dx *= -1 winsound.PlaySound('bounce.wav', winsound.SND_ASYNC) if (ball.xcor() < -340 and ball.xcor() > -350) and (ball.ycor() < paddle_a.ycor() + 40 and ball.ycor() > paddle_a.ycor() -40): ball.setx(-340) ball.dx *= -1 winsound.PlaySound('bounce.wav', winsound.SND_ASYNC) ```
2019-05-24T21:29:52.106200
Isabel
pythondev_help_Isabel_2019-05-24T21:29:52.106200
1,558,733,392.1062
25,242
pythondev
help
I cannot login to <http://bugs.python.org|bugs.python.org>. I use my google account and the error message says Provider could not be found. Can anyone help?
2019-05-24T22:49:51.108100
Sabina
pythondev_help_Sabina_2019-05-24T22:49:51.108100
1,558,738,191.1081
25,243
pythondev
help
This is a big wall of text, and you're omitting the actual error message. Can you please make a minimum reproducible example and provide the error message?
2019-05-24T23:57:35.108700
Layla
pythondev_help_Layla_2019-05-24T23:57:35.108700
1,558,742,255.1087
25,244
pythondev
help
<https://github.com/python/psf-infra-meta/issues/26>
2019-05-25T00:03:47.109100
Layla
pythondev_help_Layla_2019-05-25T00:03:47.109100
1,558,742,627.1091
25,245
pythondev
help
<@Sabina>
2019-05-25T00:04:03.109600
Layla
pythondev_help_Layla_2019-05-25T00:04:03.109600
1,558,742,643.1096
25,246
pythondev
help
Good morning. I am working with Panadas for the first time, and so far really liking it. I am trying to do some analysis on phone records. long term there are a few things I want to do, but focus right now is determining maximum number of concurrent calls to the PSTN at an individual location. I have functioning code for this, but pretty sure there is a much better way of doing this (this works, but its slow). the part below is the part I'm sure there is a better way. prior to this snippet of code I am reading the CSV file(125 column, 15000 rows) into a dataframe, filtering it down to just the PSTN Calls, and just the columns I used for that purpose I end out with a dataframe that is is about 10250x6. I'm then running it through loop below to poll the data and check minute by minute in my interested time period how many calls were active at the polling time. This works ok, but it is slow, and I'm going to be missing data still (calls that start and end between polling periods), There are a few ways I can think of to catch those calls as well but it's going to make this even slower..is there a better way I should be doing this? The idea is with the output then I can quickly find the max calls, I can graph the data show trending, etc. ``` # create empty Dataframe to store results call_df = pd.DataFrame(columns=['dateTime', 'activeCalls']) # Loop through times in one minute incremenets between start and end time for x in pd.date_range(start=start_time, end=end_time, freq="1Min"): # count number of calls that started before and ended after loop time active_calls = len(pstn_calls[(pstn_calls['origTime'] &lt;= x) &amp; pstn_calls['disconnectTime'] &gt;= x)]) # append results to DataFrame call_df = call_df.append({'dateTime': x, 'activeCalls': active_calls}, ignore_index=True) ```
2019-05-25T09:36:49.118300
Vern
pythondev_help_Vern_2019-05-25T09:36:49.118300
1,558,777,009.1183
25,247
pythondev
help
<@Vern> A couple of things come to mind. One solution would be to start with an array of zeroes for every minute you want to get statistics for, and then loop through each call record once, adding a one for every minute between the start time and end time.
2019-05-25T11:59:08.120400
Sasha
pythondev_help_Sasha_2019-05-25T11:59:08.120400
1,558,785,548.1204
25,248
pythondev
help
Another way would be to sort the start times and end times, and perform a running sum, so you'd end up with a list of times at which the concurrent call count changed, and to what new value.
2019-05-25T12:00:51.121700
Sasha
pythondev_help_Sasha_2019-05-25T12:00:51.121700
1,558,785,651.1217
25,249
pythondev
help
Hi - I'm trying to do something where I use one process to read from stdin and store a value, and another process polls that value every second and sends it somewhere else (in this case a synthesizer that plays sound). I can't figure out what I'm doing wrong
2019-05-25T12:13:09.122800
Marya
pythondev_help_Marya_2019-05-25T12:13:09.122800
1,558,786,389.1228
25,250
pythondev
help
when I type something in, the notes array in the setter function changes
2019-05-25T12:13:33.123400
Marya
pythondev_help_Marya_2019-05-25T12:13:33.123400
1,558,786,413.1234
25,251
pythondev
help
but it does not propagate to the notes variable in the poller function
2019-05-25T12:13:42.123800
Marya
pythondev_help_Marya_2019-05-25T12:13:42.123800
1,558,786,422.1238
25,252
pythondev
help
``` from multiprocessing import Process, Lock, Manager def poller(notes): print('poller is active') while True: print(notes) send(play_chord(notes)) time.sleep(1) def setter(notes): stdin = open(0) print('setter is active') for line in stdin: notes = [int(x) for x in line.split()] print('notes = ', notes) if __name__ == '__main__': manager = Manager() notes = manager.list([]) p1 = Process(target = poller, args=(notes,)) p2 = Process(target = setter, args=(notes,)) p1.start() p2.start() p2.join() ```
2019-05-25T12:15:18.124200
Marya
pythondev_help_Marya_2019-05-25T12:15:18.124200
1,558,786,518.1242
25,253
pythondev
help
output: ``` $ python3 scamp_test.py poller is active setter is active [] [] 60 65[]notes = [60, 65] [] [] [] ```
2019-05-25T12:15:49.124700
Marya
pythondev_help_Marya_2019-05-25T12:15:49.124700
1,558,786,549.1247
25,254
pythondev
help
So the line `notes = [int(x) for x in line.split()]` is reassigning the local `notes` variable to a new list. What you want to do, I think, is to change the contents in the original list object, such as `notes[:] = [int[x] for x in line.split()]`.
2019-05-25T12:28:15.126900
Sasha
pythondev_help_Sasha_2019-05-25T12:28:15.126900
1,558,787,295.1269
25,255
pythondev
help
that was it! thank you, i've been scratching my head for a while
2019-05-25T12:36:22.127500
Marya
pythondev_help_Marya_2019-05-25T12:36:22.127500
1,558,787,782.1275
25,256
pythondev
help
Does anyone know why my for loop for 'agent_names' puts the last values in the dataframe column?
2019-05-25T13:19:03.127900
Nola
pythondev_help_Nola_2019-05-25T13:19:03.127900
1,558,790,343.1279
25,257
pythondev
help
maybe im not doing " op_dept['user_issue'] = test[16]['value']" correctly because when i do print("test") it iters over each row like it should?
2019-05-25T13:21:47.129200
Nola
pythondev_help_Nola_2019-05-25T13:21:47.129200
1,558,790,507.1292
25,258
pythondev
help
You don't seem to be using `index` when you're assigning to `op_dept` at the end, which strikes me as suspicious.
2019-05-25T13:24:59.130200
Sasha
pythondev_help_Sasha_2019-05-25T13:24:59.130200
1,558,790,699.1302
25,259
pythondev
help
thanks <@Sasha> I'll give those a shot and see how that impacts the run time
2019-05-25T13:26:35.130600
Vern
pythondev_help_Vern_2019-05-25T13:26:35.130600
1,558,790,795.1306
25,260
pythondev
help
Thank you, that makes sense. but now im getting a error when i use this: for index, row in op_dept.iterrows(): agent = row['visitor_id'] agent_department = requests.get('<https://developer.livehelpnow.net/api/visitor/>'+agent, headers ={'Authorization': token}) found_agent = agent_department.json() agent_name = found_agent['payload'] agent_name = agent_name['visitor'] agent_name = agent_name['details'] test = found_agent['payload'] test = test['visitor'] test = test['details'] # op_dept['user_issue'] = test[16]['value'] # op_dept['agent_name'] = test[18]['value'] opt_dept[index,'user_issue'] = test[16]['value']
2019-05-25T13:30:21.130800
Nola
pythondev_help_Nola_2019-05-25T13:30:21.130800
1,558,791,021.1308
25,261
pythondev
help
<@Sasha> that makes sense but now im getting this error after i fix. For some reson it cant see op_dept inside the loop
2019-05-25T13:31:02.131100
Nola
pythondev_help_Nola_2019-05-25T13:31:02.131100
1,558,791,062.1311
25,262
pythondev
help
Typo: `opt` versus `op`.
2019-05-25T13:32:39.131900
Sasha
pythondev_help_Sasha_2019-05-25T13:32:39.131900
1,558,791,159.1319
25,263
pythondev
help
haha
2019-05-25T13:32:47.132300
Nola
pythondev_help_Nola_2019-05-25T13:32:47.132300
1,558,791,167.1323
25,264
pythondev
help
thank you
2019-05-25T13:32:49.132500
Nola
pythondev_help_Nola_2019-05-25T13:32:49.132500
1,558,791,169.1325
25,265
pythondev
help
running now and it seems to work thank you <@Sasha>
2019-05-25T13:33:32.132800
Nola
pythondev_help_Nola_2019-05-25T13:33:32.132800
1,558,791,212.1328
25,266
pythondev
help
ok another (probably silly) issue with the multiprocess
2019-05-25T13:57:42.135600
Marya
pythondev_help_Marya_2019-05-25T13:57:42.135600
1,558,792,662.1356
25,267
pythondev
help
i have two python programs, one outputs diffs of state, and the other (that I pasted above) read sthem
2019-05-25T13:58:02.136200
Marya
pythondev_help_Marya_2019-05-25T13:58:02.136200
1,558,792,682.1362
25,268
pythondev
help
you can see in that gif that I run the one that outputs the diffs, and it works fine, and then I run the player, and when I paste the output of the connector it works fine
2019-05-25T13:58:40.137000
Marya
pythondev_help_Marya_2019-05-25T13:58:40.137000
1,558,792,720.137
25,269
pythondev
help
None
2019-05-25T13:58:49.137300
Marya
pythondev_help_Marya_2019-05-25T13:58:49.137300
1,558,792,729.1373
25,270
pythondev
help
but when I pipe them together, it doesn't work
2019-05-25T13:58:53.137700
Marya
pythondev_help_Marya_2019-05-25T13:58:53.137700
1,558,792,733.1377
25,271
pythondev
help
``` from multiprocessing import Process, Lock, Manager def poller(notes): print('poller is active') while True: send(play_chord(notes)) time.sleep(1) def setter(notes): stdin = open(0) state = {} print('setter is active') for line in stdin: print('line: ', line) state = t.merge(state, json.loads(line, object_hook=lambda d: {int(k) if k.lstrip('-').isdigit() else k: v for k, v in d.items()})) print('state = ', state) notes[:] = fiducial_chord(state[0]) print('notes = ', notes) if __name__ == '__main__': manager = Manager() notes = manager.list([]) p1 = Process(target = poller, args=(notes,)) p2 = Process(target = setter, args=(notes,)) p1.start() p2.start() p2.join() ```
2019-05-25T13:59:09.137900
Marya
pythondev_help_Marya_2019-05-25T13:59:09.137900
1,558,792,749.1379
25,272
pythondev
help
is what is going on in the player now
2019-05-25T13:59:14.138100
Marya
pythondev_help_Marya_2019-05-25T13:59:14.138100
1,558,792,754.1381
25,273
pythondev
help
do i just need to change where I'm reading from?
2019-05-25T13:59:32.138400
Marya
pythondev_help_Marya_2019-05-25T13:59:32.138400
1,558,792,772.1384
25,274
pythondev
help
do i need to open the connector program as a subprocess here and read from that
2019-05-25T14:03:18.138800
Marya
pythondev_help_Marya_2019-05-25T14:03:18.138800
1,558,792,998.1388
25,275
pythondev
help
`echo '{"0": {"20": [0.7184887528419495, 0]}}' | python3 player.py` does work (it shows the state change and then dies because STDIN is ended)
2019-05-25T14:04:30.139300
Marya
pythondev_help_Marya_2019-05-25T14:04:30.139300
1,558,793,070.1393
25,276
pythondev
help
also `cat | python3 player.py` works and I can type in the input rather than echoing directly
2019-05-25T14:05:28.139800
Marya
pythondev_help_Marya_2019-05-25T14:05:28.139800
1,558,793,128.1398
25,277
pythondev
help
so i'm doing something dumb with how I'm reading in the input of the other python program and i'm not sure what
2019-05-25T14:05:46.140400
Marya
pythondev_help_Marya_2019-05-25T14:05:46.140400
1,558,793,146.1404
25,278
pythondev
help
It may be that the pipe is buffering output somewhere. You might try adding `flush=True` to your `print` call in your connector script.
2019-05-25T14:07:53.141400
Sasha
pythondev_help_Sasha_2019-05-25T14:07:53.141400
1,558,793,273.1414
25,279
pythondev
help
There's also a `-u` flag you can pass to `python` to get unbuffered output.
2019-05-25T14:09:13.141800
Sasha
pythondev_help_Sasha_2019-05-25T14:09:13.141800
1,558,793,353.1418
25,280
pythondev
help
yup once again you have magically found the issue thank yoU!
2019-05-25T14:11:54.142200
Marya
pythondev_help_Marya_2019-05-25T14:11:54.142200
1,558,793,514.1422
25,281
pythondev
help
Need help, Have to convert this string into python dict. But json.loads is not allowing since there is only single quotes in this str.
2019-05-25T16:58:02.144300
Jerrie
pythondev_help_Jerrie_2019-05-25T16:58:02.144300
1,558,803,482.1443
25,282
pythondev
help
Let me know any other method. But i don't want to use eval(), beacuse of the security concern
2019-05-25T16:59:04.145500
Jerrie
pythondev_help_Jerrie_2019-05-25T16:59:04.145500
1,558,803,544.1455
25,283
pythondev
help
Convert to valid json?
2019-05-25T17:26:27.146000
Hiroko
pythondev_help_Hiroko_2019-05-25T17:26:27.146000
1,558,805,187.146
25,284
pythondev
help
There's a mix of quoting types in there, so a string conversion could probably get pretty messy. Perhaps `ast.literal_eval()` is safe enough?
2019-05-25T17:41:40.146800
Sasha
pythondev_help_Sasha_2019-05-25T17:41:40.146800
1,558,806,100.1468
25,285
pythondev
help
If you restrict it down to absolutely no functions in context, even built-ins, a'la `eval(data, {"__builtins__":None},{})` you might be safe.
2019-05-25T20:45:20.148200
Carmen
pythondev_help_Carmen_2019-05-25T20:45:20.148200
1,558,817,120.1482
25,286
pythondev
help
I'm tasked with building a chatbot and looking for advice on how to approach parsing messages from users?
2019-05-26T06:41:23.150300
Conchita
pythondev_help_Conchita_2019-05-26T06:41:23.150300
1,558,852,883.1503
25,287
pythondev
help
It will be used internally with only a handful of defined use cases
2019-05-26T06:41:47.151100
Conchita
pythondev_help_Conchita_2019-05-26T06:41:47.151100
1,558,852,907.1511
25,288
pythondev
help
So want to identify certain words in a sentence - I guess this is what I would like some advice on, how to approach it?
2019-05-26T06:42:33.152000
Conchita
pythondev_help_Conchita_2019-05-26T06:42:33.152000
1,558,852,953.152
25,289
pythondev
help
Ie "@sweet-bot pls query staging death-star for me" Would need to identify `query` `staging` `death-star`
2019-05-26T06:45:24.154100
Conchita
pythondev_help_Conchita_2019-05-26T06:45:24.154100
1,558,853,124.1541
25,290
pythondev
help
The easiest and dumbest approach is regex
2019-05-26T07:02:01.155100
Jimmy
pythondev_help_Jimmy_2019-05-26T07:02:01.155100
1,558,854,121.1551
25,291
pythondev
help
your choices are `{keyword} in string`, regex, then neural nets
2019-05-26T07:02:07.155500
Bethany
pythondev_help_Bethany_2019-05-26T07:02:07.155500
1,558,854,127.1555
25,292
pythondev
help
in order of increasing usefulness and complexity
2019-05-26T07:02:19.156000
Bethany
pythondev_help_Bethany_2019-05-26T07:02:19.156000
1,558,854,139.156
25,293
pythondev
help
:point_up:
2019-05-26T07:02:29.156300
Jimmy
pythondev_help_Jimmy_2019-05-26T07:02:29.156300
1,558,854,149.1563
25,294
pythondev
help
actually there'sa few intermediates. `spacy` is a good nlp library. Or go with a vendor chatbot solution like google dialogflow
2019-05-26T07:03:20.157000
Bethany
pythondev_help_Bethany_2019-05-26T07:03:20.157000
1,558,854,200.157
25,295
pythondev
help
I think I will go with regex then as `{keyword} in string` will be to simple and neural nets too complex
2019-05-26T07:09:24.158000
Conchita
pythondev_help_Conchita_2019-05-26T07:09:24.158000
1,558,854,564.158
25,296
pythondev
help
I'll also have a look at dialogflow. Thanks <@Jimmy> <@Bethany> :taco:
2019-05-26T07:09:57.158600
Conchita
pythondev_help_Conchita_2019-05-26T07:09:57.158600
1,558,854,597.1586
25,297
pythondev
help
I recently learnt how to use regex. It's so cool
2019-05-26T07:10:09.158900
Conchita
pythondev_help_Conchita_2019-05-26T07:10:09.158900
1,558,854,609.1589
25,298
pythondev
help
Does any one know how to rename an non empty directory?
2019-05-26T07:17:42.160100
Nella
pythondev_help_Nella_2019-05-26T07:17:42.160100
1,558,855,062.1601
25,299
pythondev
help
you want to change the name of the dictionary or some of its keys?
2019-05-26T07:30:14.160500
Bethany
pythondev_help_Bethany_2019-05-26T07:30:14.160500
1,558,855,814.1605
25,300
pythondev
help
change the name of that dictionary
2019-05-26T07:31:09.160700
Nella
pythondev_help_Nella_2019-05-26T07:31:09.160700
1,558,855,869.1607
25,301
pythondev
help
For example, I want to make `some/path/old/` to `some/path/new/`, there’s files inside
2019-05-26T07:32:06.161600
Nella
pythondev_help_Nella_2019-05-26T07:32:06.161600
1,558,855,926.1616
25,302
pythondev
help
oh directory, you can to that with move
2019-05-26T07:37:47.162000
Bethany
pythondev_help_Bethany_2019-05-26T07:37:47.162000
1,558,856,267.162
25,303
pythondev
help
<https://docs.python.org/3/library/shutil.html#shutil.move>
2019-05-26T07:38:09.162200
Bethany
pythondev_help_Bethany_2019-05-26T07:38:09.162200
1,558,856,289.1622
25,304
pythondev
help
i am tired i misread
2019-05-26T07:38:51.162400
Bethany
pythondev_help_Bethany_2019-05-26T07:38:51.162400
1,558,856,331.1624
25,305
pythondev
help
It works
2019-05-26T07:41:56.163100
Nella
pythondev_help_Nella_2019-05-26T07:41:56.163100
1,558,856,516.1631
25,306
pythondev
help
But now I have another problem. If `some/path/new/` exists, `shutil.move` will move my directory to `some/path/new/old`. Why is that?
2019-05-26T07:42:59.164100
Nella
pythondev_help_Nella_2019-05-26T07:42:59.164100
1,558,856,579.1641
25,307
pythondev
help
oh it works a bit differently than `mv`, <https://docs.python.org/3/library/os.html#os.rename> might work for you
2019-05-26T07:48:25.164500
Bethany
pythondev_help_Bethany_2019-05-26T07:48:25.164500
1,558,856,905.1645
25,308
pythondev
help
Thanks for your help
2019-05-26T10:25:26.165400
Nella
pythondev_help_Nella_2019-05-26T10:25:26.165400
1,558,866,326.1654
25,309
pythondev
help
Is there a syntax for adding a column with a predefined value to a list of list?
2019-05-27T01:22:26.167900
Chuck
pythondev_help_Chuck_2019-05-27T01:22:26.167900
1,558,920,146.1679
25,310
pythondev
help
e.g., I have something like this: ``` [ ['a', 1], ['b', 2] ] ``` and I want to add a column with a known value to all the sublists, so I have something like: ``` [ ['Value', 'a', 1], ['Value', 'b', 2] ] ```
2019-05-27T01:23:44.169100
Chuck
pythondev_help_Chuck_2019-05-27T01:23:44.169100
1,558,920,224.1691
25,311
pythondev
help
for li in list: li.append(value)
2019-05-27T01:24:39.170200
Malika
pythondev_help_Malika_2019-05-27T01:24:39.170200
1,558,920,279.1702
25,312
pythondev
help
does that modify the original list?
2019-05-27T01:26:25.171700
Chuck
pythondev_help_Chuck_2019-05-27T01:26:25.171700
1,558,920,385.1717
25,313
pythondev
help
and wouldn't that put the appended value at the end?
2019-05-27T01:26:36.172000
Chuck
pythondev_help_Chuck_2019-05-27T01:26:36.172000
1,558,920,396.172
25,314
pythondev
help
yes
2019-05-27T01:26:42.172200
Malika
pythondev_help_Malika_2019-05-27T01:26:42.172200
1,558,920,402.1722
25,315
pythondev
help
lists are immutable
2019-05-27T01:26:47.172500
Malika
pythondev_help_Malika_2019-05-27T01:26:47.172500
1,558,920,407.1725
25,316
pythondev
help
Imperative approach: ``` for sublist, value in zip(your_list, new_values): sublist.insert(0, value) ``` Functional approach: ``` new_list = [[value, *sublist] for sublist, value in zip(your_list, new_values)] ```
2019-05-27T01:27:13.172800
Chester
pythondev_help_Chester_2019-05-27T01:27:13.172800
1,558,920,433.1728
25,317
pythondev
help
``` &gt;&gt;&gt; your_list = [ ... ['a', 1], ... ['b', 2] ... ] &gt;&gt;&gt; new_values = ['Foo', 'Bar'] &gt;&gt;&gt; new_list = [[value, *sublist] for sublist, value in zip(your_list, new_values)] &gt;&gt;&gt; new_list [['Foo', 'a', 1], ['Bar', 'b', 2]] ```
2019-05-27T01:27:20.173000
Chester
pythondev_help_Chester_2019-05-27T01:27:20.173000
1,558,920,440.173
25,318
pythondev
help
<@Malika> lists are mutable. Tuples are immutable.
2019-05-27T01:27:35.173300
Chester
pythondev_help_Chester_2019-05-27T01:27:35.173300
1,558,920,455.1733
25,319
pythondev
help
Hmmm. <@Chester> if I want the same static value added as a column to each of the sublists... does the functional approach above still work?
2019-05-27T01:28:38.174400
Chuck
pythondev_help_Chuck_2019-05-27T01:28:38.174400
1,558,920,518.1744
25,320