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
Now it works, the only problem is lines that should be drawn on screen rarely appearing
2017-09-13T07:47:40.000036
Shirl
pythondev_help_Shirl_2017-09-13T07:47:40.000036
1,505,288,860.000036
93,603
pythondev
help
Hi everyone, there's a challenge on which I would like suggestions how to best approach. We have like 200,000 messages which are grouped into (Categories->subcategories-> tags), A usecase is: (i) Show all Categories on the same screen (ii) When a user clicks on one of the Category bars, show all of the subcategories on the same screen (iii) When a user clicks on one of the subcategories bars, show the tags under the subcategory. We are using google charts for this right now but it is painfully slow. How would anyone here go about this? P.S. The minimum we can go is to set the retrieved data to a span of one week at any viewing time.
2017-09-13T08:00:45.000198
Daniell
pythondev_help_Daniell_2017-09-13T08:00:45.000198
1,505,289,645.000198
93,604
pythondev
help
<@Daniell> use a database with D3 or Highcharts?
2017-09-13T08:43:11.000366
Meg
pythondev_help_Meg_2017-09-13T08:43:11.000366
1,505,292,191.000366
93,605
pythondev
help
<https://d3js.org/>
2017-09-13T08:44:01.000022
Meg
pythondev_help_Meg_2017-09-13T08:44:01.000022
1,505,292,241.000022
93,606
pythondev
help
<https://www.highcharts.com/>
2017-09-13T08:44:04.000197
Meg
pythondev_help_Meg_2017-09-13T08:44:04.000197
1,505,292,244.000197
93,607
pythondev
help
the former is free, the latter is paid
2017-09-13T08:44:11.000021
Meg
pythondev_help_Meg_2017-09-13T08:44:11.000021
1,505,292,251.000021
93,608
pythondev
help
Here's my code <https://gist.github.com/anonymous/050039dcc320b2298ee0f30cf1d699b7>
2017-09-13T08:46:30.000136
Honey
pythondev_help_Honey_2017-09-13T08:46:30.000136
1,505,292,390.000136
93,609
pythondev
help
In this case I suppose it means that `left` is `None` so you can't do `left(..)`
2017-09-13T08:47:24.000238
Ciera
pythondev_help_Ciera_2017-09-13T08:47:24.000238
1,505,292,444.000238
93,610
pythondev
help
<@Ciera> thanks, so how would I go about fixing it?
2017-09-13T08:48:57.000167
Honey
pythondev_help_Honey_2017-09-13T08:48:57.000167
1,505,292,537.000167
93,611
pythondev
help
Will look into it too. Thanks.
2017-09-13T08:49:04.000036
Felicita
pythondev_help_Felicita_2017-09-13T08:49:04.000036
1,505,292,544.000036
93,612
pythondev
help
``` left, right = None, None node_value = 0 tmp_right, tmp_left = None, None node_list = [] for elem in the_matrix[the_root]: if elem: if (node_value &gt; the_root): node_list.append(right(root, node_value)) else: node_list.append(left(root, node_value)) node_value += 1 ```
2017-09-13T08:49:59.000149
Ciera
pythondev_help_Ciera_2017-09-13T08:49:59.000149
1,505,292,599.000149
93,613
pythondev
help
you can't set something to `None` then call it
2017-09-13T08:50:10.000070
Ciera
pythondev_help_Ciera_2017-09-13T08:50:10.000070
1,505,292,610.00007
93,614
pythondev
help
I don't really know what your goal is, Maybe `node_list.append((left, root, node_value))`
2017-09-13T08:50:50.000066
Ciera
pythondev_help_Ciera_2017-09-13T08:50:50.000066
1,505,292,650.000066
93,615
pythondev
help
if that's what you need
2017-09-13T08:50:59.000313
Ciera
pythondev_help_Ciera_2017-09-13T08:50:59.000313
1,505,292,659.000313
93,616
pythondev
help
Thanks. I’m solving this question without using additional Tree Node data structure. It says that the question can be solved with in place traversal of the input matrix using BST property of tree, so I’m trying that. ```` Find the least common ancestor between two nodes on a binary search tree. The least common ancestor is the farthest node from the root that is an ancestor of both nodes. For example, the root is a common ancestor of all nodes on the tree, but if both nodes are descendents of the root's left child, then that left child might be the lowest common ancestor. You can assume that both nodes are in the tree, and the tree itself adheres to all BST properties. The function definition should look like question4(T, r, n1, n2), where Tis the tree represented as a matrix, where the index of the list is equal to the integer stored in that node and a 1 represents a child node, r is a non-negative integer representing the root, and n1 and n2 are non-negative integers representing the two nodes in no particular order. For example, one test case might be ... question4([[0, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1], [0, 0, 0, 0, 0]], 3, 1, 4) """ ```
2017-09-13T09:05:41.000401
Honey
pythondev_help_Honey_2017-09-13T09:05:41.000401
1,505,293,541.000401
93,617
pythondev
help
Hi everyone, has anyone here already tried to implement <http://draw.io|draw.io> or GraphEditor to a django app ?
2017-09-13T11:28:36.000072
Stewart
pythondev_help_Stewart_2017-09-13T11:28:36.000072
1,505,302,116.000072
93,618
pythondev
help
Hi! I've stated using SQLAlchemy in my new project and can not exactly get the relationships part. I have a method which goes over a list of `Candidate` objects, its model has ` applications = relationship('Application', backref='candidate', )` and in that loop I want to merge the Candidate objects to different session. Problem is that it only merges the `Candidates` not the `Application` objects to the other session. I have a feeling that there is a setting that I'm missing either on the merge or model side that would enable saving all of the related models.
2017-09-13T11:47:59.000437
Mavis
pythondev_help_Mavis_2017-09-13T11:47:59.000437
1,505,303,279.000437
93,619
pythondev
help
Hello all! why I do have this error here: b = map(sum,a) TypeError: 'int' object is not iterable ``` a = [1,2,3,4] b = map(sum,a) print b ```
2017-09-13T13:05:20.000311
Floy
pythondev_help_Floy_2017-09-13T13:05:20.000311
1,505,307,920.000311
93,620
pythondev
help
`sum` expects an iterable of numbers to add together
2017-09-13T13:05:42.000353
Frieda
pythondev_help_Frieda_2017-09-13T13:05:42.000353
1,505,307,942.000353
93,621
pythondev
help
`map` iterates over each thing in an iterable and applies a function to it
2017-09-13T13:05:54.000517
Frieda
pythondev_help_Frieda_2017-09-13T13:05:54.000517
1,505,307,954.000517
93,622
pythondev
help
`map(sum, a))` says to apply `sum` to each individual item in `a`
2017-09-13T13:06:07.000015
Frieda
pythondev_help_Frieda_2017-09-13T13:06:07.000015
1,505,307,967.000015
93,623
pythondev
help
I see, thank you!
2017-09-13T13:07:14.000092
Floy
pythondev_help_Floy_2017-09-13T13:07:14.000092
1,505,308,034.000092
93,624
pythondev
help
sum is not used the right way
2017-09-13T13:08:14.000072
Floy
pythondev_help_Floy_2017-09-13T13:08:14.000072
1,505,308,094.000072
93,625
pythondev
help
if you just need to add up the list of numbers `sum(a)` will do exactly what you want
2017-09-13T13:09:13.000298
Frieda
pythondev_help_Frieda_2017-09-13T13:09:13.000298
1,505,308,153.000298
93,626
pythondev
help
there's not really any way to use `map` to add a list of numbers. `reduce` could do it, but there's no reason to since `sum` exists
2017-09-13T13:09:32.000395
Frieda
pythondev_help_Frieda_2017-09-13T13:09:32.000395
1,505,308,172.000395
93,627
pythondev
help
I some slick way to sum up two dimensional list :slightly_smiling_face:
2017-09-13T13:11:07.000634
Floy
pythondev_help_Floy_2017-09-13T13:11:07.000634
1,505,308,267.000634
93,628
pythondev
help
other than : `b = sum([sum(x) for x in a])`
2017-09-13T13:11:21.000105
Floy
pythondev_help_Floy_2017-09-13T13:11:21.000105
1,505,308,281.000105
93,629
pythondev
help
what's wrong with that?
2017-09-13T13:11:33.000513
Meg
pythondev_help_Meg_2017-09-13T13:11:33.000513
1,505,308,293.000513
93,630
pythondev
help
nothing, just want a shorter one :slightly_smiling_face:
2017-09-13T13:11:49.000172
Floy
pythondev_help_Floy_2017-09-13T13:11:49.000172
1,505,308,309.000172
93,631
pythondev
help
make a method
2017-09-13T13:11:57.000183
Meg
pythondev_help_Meg_2017-09-13T13:11:57.000183
1,505,308,317.000183
93,632
pythondev
help
and return that list comprehension
2017-09-13T13:12:11.000272
Meg
pythondev_help_Meg_2017-09-13T13:12:11.000272
1,505,308,331.000272
93,633
pythondev
help
:smile:
2017-09-13T13:12:24.000152
Meg
pythondev_help_Meg_2017-09-13T13:12:24.000152
1,505,308,344.000152
93,634
pythondev
help
should be done without for, possible?
2017-09-13T13:12:24.000523
Floy
pythondev_help_Floy_2017-09-13T13:12:24.000523
1,505,308,344.000523
93,635
pythondev
help
i mean, that's clear and explicit
2017-09-13T13:12:26.000242
Frieda
pythondev_help_Frieda_2017-09-13T13:12:26.000242
1,505,308,346.000242
93,636
pythondev
help
it is clear and explicit
2017-09-13T13:12:35.000005
Floy
pythondev_help_Floy_2017-09-13T13:12:35.000005
1,505,308,355.000005
93,637
pythondev
help
why? it's fine
2017-09-13T13:12:35.000487
Frieda
pythondev_help_Frieda_2017-09-13T13:12:35.000487
1,505,308,355.000487
93,638
pythondev
help
I know its fine, just get bored :slightly_smiling_face:
2017-09-13T13:12:55.000482
Floy
pythondev_help_Floy_2017-09-13T13:12:55.000482
1,505,308,375.000482
93,639
pythondev
help
I think you're having a case of premature optimization and cleverness.
2017-09-13T13:13:03.000125
Meg
pythondev_help_Meg_2017-09-13T13:13:03.000125
1,505,308,383.000125
93,640
pythondev
help
and tired
2017-09-13T13:13:03.000408
Floy
pythondev_help_Floy_2017-09-13T13:13:03.000408
1,505,308,383.000408
93,641
pythondev
help
I know :slightly_smiling_face:
2017-09-13T13:13:12.000156
Floy
pythondev_help_Floy_2017-09-13T13:13:12.000156
1,505,308,392.000156
93,642
pythondev
help
being clever is a good thing, when its clear what you're doing
2017-09-13T13:13:18.000043
Meg
pythondev_help_Meg_2017-09-13T13:13:18.000043
1,505,308,398.000043
93,643
pythondev
help
and someone else apart from you can read that :slightly_smiling_face:
2017-09-13T13:13:31.000091
Floy
pythondev_help_Floy_2017-09-13T13:13:31.000091
1,505,308,411.000091
93,644
pythondev
help
bingo
2017-09-13T13:13:35.000279
Meg
pythondev_help_Meg_2017-09-13T13:13:35.000279
1,505,308,415.000279
93,645
pythondev
help
you should almost never be clever
2017-09-13T13:13:39.000012
Frieda
pythondev_help_Frieda_2017-09-13T13:13:39.000012
1,505,308,419.000012
93,646
pythondev
help
which, unfortunately is not the case
2017-09-13T13:13:41.000193
Meg
pythondev_help_Meg_2017-09-13T13:13:41.000193
1,505,308,421.000193
93,647
pythondev
help
boring and obvious is _great_
2017-09-13T13:13:54.000161
Frieda
pythondev_help_Frieda_2017-09-13T13:13:54.000161
1,505,308,434.000161
93,648
pythondev
help
if you can be clever while being readable, understandable and efficient, why not. But that's a pretty tough trinity to hit
2017-09-13T13:14:33.000188
Meg
pythondev_help_Meg_2017-09-13T13:14:33.000188
1,505,308,473.000188
93,649
pythondev
help
good for cold golfing, though
2017-09-13T13:15:05.000179
Meg
pythondev_help_Meg_2017-09-13T13:15:05.000179
1,505,308,505.000179
93,650
pythondev
help
OK, thank you! I'm done for today :slightly_smiling_face:
2017-09-13T13:16:16.000625
Floy
pythondev_help_Floy_2017-09-13T13:16:16.000625
1,505,308,576.000625
93,651
pythondev
help
PyDanny gave a good talk in 2011 about being stupid and lazy. <https://www.slideshare.net/pydanny/confessions-of-a-joe-developer>
2017-09-13T13:18:02.000251
Frieda
pythondev_help_Frieda_2017-09-13T13:18:02.000251
1,505,308,682.000251
93,652
pythondev
help
logged in as root
2017-09-13T13:33:16.000198
Beverley
pythondev_help_Beverley_2017-09-13T13:33:16.000198
1,505,309,596.000198
93,653
pythondev
help
`chown -R django:django`
2017-09-13T13:37:15.000153
Meg
pythondev_help_Meg_2017-09-13T13:37:15.000153
1,505,309,835.000153
93,654
pythondev
help
great thanks
2017-09-13T13:37:35.000034
Beverley
pythondev_help_Beverley_2017-09-13T13:37:35.000034
1,505,309,855.000034
93,655
pythondev
help
I should do this from inside the folder, right
2017-09-13T13:38:08.000308
Beverley
pythondev_help_Beverley_2017-09-13T13:38:08.000308
1,505,309,888.000308
93,656
pythondev
help
correct
2017-09-13T13:38:56.000349
Meg
pythondev_help_Meg_2017-09-13T13:38:56.000349
1,505,309,936.000349
93,657
pythondev
help
or provide the full path
2017-09-13T13:39:02.000365
Meg
pythondev_help_Meg_2017-09-13T13:39:02.000365
1,505,309,942.000365
93,658
pythondev
help
don't you need to provide a path anyway?
2017-09-13T13:39:52.000433
Frieda
pythondev_help_Frieda_2017-09-13T13:39:52.000433
1,505,309,992.000433
93,659
pythondev
help
`chown -R django:django .`
2017-09-13T13:39:57.000391
Frieda
pythondev_help_Frieda_2017-09-13T13:39:57.000391
1,505,309,997.000391
93,660
pythondev
help
forgot that last period
2017-09-13T13:40:48.000611
Meg
pythondev_help_Meg_2017-09-13T13:40:48.000611
1,505,310,048.000611
93,661
pythondev
help
with the period it works
2017-09-13T13:40:58.000722
Beverley
pythondev_help_Beverley_2017-09-13T13:40:58.000722
1,505,310,058.000722
93,662
pythondev
help
with the period it works
2017-09-13T13:41:42.000482
Beverley
pythondev_help_Beverley_2017-09-13T13:41:42.000482
1,505,310,102.000482
93,663
pythondev
help
Struggling with mysql.connector. ``` sql = 'INSERT INTO MARKET_DATA_ACTIVE_DHCP (SM_ID, NODE_PORT_NODE, VLAN_VPI,' \ ' CTAG, DSLAM) VALUES (%(redback)s, %(slot_port)s, %(vlan)s, %(ctag)s, %(dslam)s)' \ ' ON DUPLICATE KEY UPDATE DSLAM = %(dslam)s, LAST_SEEN=CURRENT_TIMESTAMP;' args = (('rbohmnfd80', '3/7', '662', '38', 'GLSTOHXAH03'), ('rbksgrnr80', '9/3', '752', '34', 'BURLKSAWRLA'), ('rbncrcmt92', '3/1', '740', '100', 'GNVLNCGXRLA')) keys = 'redback slot_port vlan ctag dslam'.split() args = [{key: arg for key, arg in zip(keys, args_set)} for args_set in args] with mysql_connect(config) as cursor: print(cursor.executemany(sql, args)) Traceback: mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%(dslam)s' at line 1 ``` It seems the dictionary keys work in the insert statement, but after the update clause it isn't substituting.
2017-09-13T14:29:37.000441
Meghan
pythondev_help_Meghan_2017-09-13T14:29:37.000441
1,505,312,977.000441
93,664
pythondev
help
Also, ```.callproc``` doesn't seem to allow for multiple sets of data at once, is there a way to do that? It would be preferred if so.
2017-09-13T14:30:24.000492
Meghan
pythondev_help_Meghan_2017-09-13T14:30:24.000492
1,505,313,024.000492
93,665
pythondev
help
If anyone was wondering about mysql_connect above, that's not standard to the library, though similar probably should be... ``` @contextmanager def mysql_connect(config, commit=True): with closing(connection.MySQLConnection(**config)) as cnx: with closing(cnx.cursor()) as cursor: yield cursor if commit: cnx.commit() ```
2017-09-13T14:33:59.000494
Meghan
pythondev_help_Meghan_2017-09-13T14:33:59.000494
1,505,313,239.000494
93,666
pythondev
help
<@Meghan>, would a `REPLACE` statement be viable here?
2017-09-13T15:06:57.000614
Winnifred
pythondev_help_Winnifred_2017-09-13T15:06:57.000614
1,505,315,217.000614
93,667
pythondev
help
Not to be dismissive, but there’s also a not-too-old SO thread about it: <https://stackoverflow.com/questions/37006202/bulk-update-mysql-with-python#37008749>.
2017-09-13T15:11:10.000356
Winnifred
pythondev_help_Winnifred_2017-09-13T15:11:10.000356
1,505,315,470.000356
93,668
pythondev
help
<@Winnifred> Yeah, it looks like that may be the way. Such a pain.
2017-09-13T15:43:33.000344
Meghan
pythondev_help_Meghan_2017-09-13T15:43:33.000344
1,505,317,413.000344
93,669
pythondev
help
<@Manuel> fully parsing javascript with regex would have similar problems as fully parsing html with regex - as made famous in this stack overflow answer <https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454>
2017-09-13T16:03:42.000390
Antionette
pythondev_help_Antionette_2017-09-13T16:03:42.000390
1,505,318,622.00039
93,670
pythondev
help
<https://i.ytimg.com/vi/qPopSBUpQ_4/hqdefault.jpg>
2017-09-13T16:06:08.000208
Mallie
pythondev_help_Mallie_2017-09-13T16:06:08.000208
1,505,318,768.000208
93,671
pythondev
help
<@Manuel> moving it over here are these the top level functions you want? ``` function cmMedicalDevicesTreatmentsController function activate function initializeScope function getTreatments function refreshWidget function addTreatment function editTreatment function deleteTreatment function nullString```
2017-09-13T16:07:40.000237
Martha
pythondev_help_Martha_2017-09-13T16:07:40.000237
1,505,318,860.000237
93,672
pythondev
help
I want all top level functions (cmMedicalDevicesTreatmentsController) and their content.
2017-09-13T16:08:07.000252
Manuel
pythondev_help_Manuel_2017-09-13T16:08:07.000252
1,505,318,887.000252
93,673
pythondev
help
My regex doesn't seem to be able to match the correct closing curly brace. That why I thought the "iterating" stack overflow answer might be the best option.
2017-09-13T16:09:01.000354
Manuel
pythondev_help_Manuel_2017-09-13T16:09:01.000354
1,505,318,941.000354
93,674
pythondev
help
basically find the first function, then count all the opening and closing braces and parens until I get back to the correct closing one.
2017-09-13T16:09:38.000652
Manuel
pythondev_help_Manuel_2017-09-13T16:09:38.000652
1,505,318,978.000652
93,675
pythondev
help
just the raw data inside the open and close for `cmMedicalDevicesTreatmentsController`? - sorry just clarifying
2017-09-13T16:10:28.000582
Martha
pythondev_help_Martha_2017-09-13T16:10:28.000582
1,505,319,028.000582
93,676
pythondev
help
yeah, that's basically what I'm seeing... regex no es sufficiente
2017-09-13T16:10:38.000317
Manuel
pythondev_help_Manuel_2017-09-13T16:10:38.000317
1,505,319,038.000317
93,677
pythondev
help
I need the function declaration and it's body
2017-09-13T16:11:07.000220
Manuel
pythondev_help_Manuel_2017-09-13T16:11:07.000220
1,505,319,067.00022
93,678
pythondev
help
Hi all. I have what might be a bit of a stupid question, but I’m trying to sort out the most ‘appropriate’ way to handle multiple bitfields (with what are effectively defined boolean flags). I saw this ctypes answer on SO…<https://stackoverflow.com/a/11481471>
2017-09-13T18:31:28.000304
Gale
pythondev_help_Gale_2017-09-13T18:31:28.000304
1,505,327,488.000304
93,679
pythondev
help
A single bitfield would effectively look like (stealing the code example):
2017-09-13T18:31:58.000275
Gale
pythondev_help_Gale_2017-09-13T18:31:58.000275
1,505,327,518.000275
93,680
pythondev
help
So, do I have to do the insane thing and create a bits struct, and a union where I cast the byte into the struct for every single bitfield? I’m looking at upwards of 20 of these things, and I can imagine the sheer number of classes being a painful thing to manage
2017-09-13T18:33:42.000206
Gale
pythondev_help_Gale_2017-09-13T18:33:42.000206
1,505,327,622.000206
93,681
pythondev
help
Need help :pray: ``` list_a = [{'a': 1}, {'b': 2}, {'c'; 3}] list_b = [{'a':3}, {'d': 4}, {'c':5}, {'e':6}] # if lista_a is newer than list_b the result should be: # [{'a':1}, {'b':2}, {'c':3}, {'d':4}, {'e':6}] # and if list_b is newer than list_a the result should be: # [{'a':3}, {'b':2}, {'c':5}, {'d':4}, {'e':6}] ``` thanks
2017-09-13T21:10:38.000026
Mercedez
pythondev_help_Mercedez_2017-09-13T21:10:38.000026
1,505,337,038.000026
93,682
pythondev
help
<@Mercedez> what do you define as “newer”?
2017-09-13T21:17:51.000032
Delphine
pythondev_help_Delphine_2017-09-13T21:17:51.000032
1,505,337,471.000032
93,683
pythondev
help
i have a list, and the newer list is an input from the user. and i need to merge them
2017-09-13T21:22:23.000176
Mercedez
pythondev_help_Mercedez_2017-09-13T21:22:23.000176
1,505,337,743.000176
93,684
pythondev
help
its old user data and new user data.
2017-09-13T21:22:45.000018
Mercedez
pythondev_help_Mercedez_2017-09-13T21:22:45.000018
1,505,337,765.000018
93,685
pythondev
help
have you tried list.extend()
2017-09-13T21:28:43.000234
Krishna
pythondev_help_Krishna_2017-09-13T21:28:43.000234
1,505,338,123.000234
93,686
pythondev
help
?
2017-09-13T21:28:46.000080
Krishna
pythondev_help_Krishna_2017-09-13T21:28:46.000080
1,505,338,126.00008
93,687
pythondev
help
<@Mercedez> are you sure the internal dictionaries only have 1 key?
2017-09-13T21:29:27.000249
Delphine
pythondev_help_Delphine_2017-09-13T21:29:27.000249
1,505,338,167.000249
93,688
pythondev
help
<@Mercedez> if that’s the case then using tuples would be better. then you could use sets to combine.
2017-09-13T21:30:24.000133
Delphine
pythondev_help_Delphine_2017-09-13T21:30:24.000133
1,505,338,224.000133
93,689
pythondev
help
<@Delphine> awesome!
2017-09-13T21:55:36.000009
Mercedez
pythondev_help_Mercedez_2017-09-13T21:55:36.000009
1,505,339,736.000009
93,690
pythondev
help
I believe the reason it throws this error "(failed) net::ERR_INCOMPLETE_CHUNKED_ENCODING" during uploading is nginx fails to get permission to upload the file, the folder it should upload to is empty
2017-09-14T00:19:58.000156
Beverley
pythondev_help_Beverley_2017-09-14T00:19:58.000156
1,505,348,398.000156
93,691
pythondev
help
snapshot from the view of the folder it targets and it's empty meaning it never uploads the file
2017-09-14T00:21:26.000180
Beverley
pythondev_help_Beverley_2017-09-14T00:21:26.000180
1,505,348,486.00018
93,692
pythondev
help
Hi folks, any one can help me to write python mysqldb modules
2017-09-14T02:29:36.000106
Bell
pythondev_help_Bell_2017-09-14T02:29:36.000106
1,505,356,176.000106
93,693
pythondev
help
#!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.connect("localhost","root","redbury","testdb" ) # prepare a cursor object using cursor() method cursor = db.cursor() # Create table as per requirement sql = """CREATE TABLE EMPLOYEE4 ( FIRST_NAME CHAR(20) NOT NULL, LAST_NAME CHAR(20), AGE INT, SEX CHAR(1), INCOME FLOAT )""" # execute SQL query using execute() method. cursor.execute(sql) print (cursor.fetchall()) #for row in data: # print row[0] #print("Returned rows:\n{}".format(data)) #print (data) # disconnect from server db.close()
2017-09-14T02:29:55.000167
Bell
pythondev_help_Bell_2017-09-14T02:29:55.000167
1,505,356,195.000167
93,694
pythondev
help
I want to get fetchall() method to get output. but its not working . how to use fetchall() to get print
2017-09-14T02:30:30.000221
Bell
pythondev_help_Bell_2017-09-14T02:30:30.000221
1,505,356,230.000221
93,695
pythondev
help
you need to execute a sql query that retrieve data for `fetchall` to return data
2017-09-14T02:53:45.000201
Ciera
pythondev_help_Ciera_2017-09-14T02:53:45.000201
1,505,357,625.000201
93,696
pythondev
help
and please use slack formatting or snippet. <https://get.slack.help/hc/en-us/articles/202288908-Format-your-messages>
2017-09-14T02:54:15.000069
Ciera
pythondev_help_Ciera_2017-09-14T02:54:15.000069
1,505,357,655.000069
93,697
pythondev
help
```#!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.connect("localhost","root","redbury","testdb" ) # prepare a cursor object using cursor() method cursor = db.cursor() # Create table as per requirement sql = """CREATE TABLE EMPLOYEE4 ( FIRST_NAME CHAR(20) NOT NULL, LAST_NAME CHAR(20), AGE INT, SEX CHAR(1), INCOME FLOAT )""" # execute SQL query using execute() method. cursor.execute(sql) print (cursor.fetchall()) #for row in data: # print row[0] #print("Returned rows:\n{}".format(data)) #print (data) # disconnect from server db.close()```
2017-09-14T02:56:47.000297
Bell
pythondev_help_Bell_2017-09-14T02:56:47.000297
1,505,357,807.000297
93,698
pythondev
help
do you have any script like that ?
2017-09-14T02:57:21.000295
Bell
pythondev_help_Bell_2017-09-14T02:57:21.000295
1,505,357,841.000295
93,699
pythondev
help
are you following a tutorial and/or are you familiar with sql ?
2017-09-14T02:58:42.000167
Ciera
pythondev_help_Ciera_2017-09-14T02:58:42.000167
1,505,357,922.000167
93,700
pythondev
help
Hey guys, i am storing time in my model like this "Sept. 6, 2017, 2:21 p.m." is there anyway i can transform this into a date like so /DD/MM/YYYY when pulling it from the db?
2017-09-14T04:16:12.000134
Robbin
pythondev_help_Robbin_2017-09-14T04:16:12.000134
1,505,362,572.000134
93,701
pythondev
help
you are storing it as a string?
2017-09-14T04:17:54.000105
Junita
pythondev_help_Junita_2017-09-14T04:17:54.000105
1,505,362,674.000105
93,702