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 have a Q on __file__ though? that is not referenced later on anywhere in the code so I'm wondering how its able to get the basedir in that instance | 2018-01-04T13:27:42.000643 | Ji | pythondev_help_Ji_2018-01-04T13:27:42.000643 | 1,515,072,462.000643 | 27,724 |
pythondev | help | `__file__` is a special constant, which is a filename of a script | 2018-01-04T13:28:30.000662 | Barney | pythondev_help_Barney_2018-01-04T13:28:30.000662 | 1,515,072,510.000662 | 27,725 |
pythondev | help | i.e. python itself sets this variable | 2018-01-04T13:28:56.000011 | Barney | pythondev_help_Barney_2018-01-04T13:28:56.000011 | 1,515,072,536.000011 | 27,726 |
pythondev | help | so basically basedir is getting the basedir of where the python file itself is? | 2018-01-04T13:29:55.000332 | Ji | pythondev_help_Ji_2018-01-04T13:29:55.000332 | 1,515,072,595.000332 | 27,727 |
pythondev | help | yes | 2018-01-04T13:30:07.000135 | Barney | pythondev_help_Barney_2018-01-04T13:30:07.000135 | 1,515,072,607.000135 | 27,728 |
pythondev | help | ahh ok - and that's why when I was typing print (basedir) in Jupyter it kept erroring out - gotcha! | 2018-01-04T13:30:29.000485 | Ji | pythondev_help_Ji_2018-01-04T13:30:29.000485 | 1,515,072,629.000485 | 27,729 |
pythondev | help | i.e., you are in `/home`, and do `python aditya/script.py`
The following is true:
```
__file__ == 'aditya/script.py'
os.path.realpath(__file__) == '/home/aditya/script.py'
os.path.dirname(os.path.realpath(__file__)) == '/home/aditya'
``` | 2018-01-04T13:31:31.000140 | Barney | pythondev_help_Barney_2018-01-04T13:31:31.000140 | 1,515,072,691.00014 | 27,730 |
pythondev | help | thanks a lot for that explanation leo - makes perfect sense | 2018-01-04T13:33:44.000357 | Ji | pythondev_help_Ji_2018-01-04T13:33:44.000357 | 1,515,072,824.000357 | 27,731 |
pythondev | help | anyone no of any good tutorials/reading material for managing buffers of child processes? | 2018-01-04T13:42:19.000551 | Shante | pythondev_help_Shante_2018-01-04T13:42:19.000551 | 1,515,073,339.000551 | 27,732 |
pythondev | help | how to fix the 'ImportError: No module named jinja2' error?? | 2018-01-04T15:24:49.000397 | Alecia | pythondev_help_Alecia_2018-01-04T15:24:49.000397 | 1,515,079,489.000397 | 27,733 |
pythondev | help | Installed jijnja2 using pip but still same prob' | 2018-01-04T15:25:47.000670 | Alecia | pythondev_help_Alecia_2018-01-04T15:25:47.000670 | 1,515,079,547.00067 | 27,734 |
pythondev | help | make sure you installed it in the proper environment | 2018-01-04T15:28:51.000350 | Heriberto | pythondev_help_Heriberto_2018-01-04T15:28:51.000350 | 1,515,079,731.00035 | 27,735 |
pythondev | help | and that your enviroment is active | 2018-01-04T15:29:19.000630 | Floy | pythondev_help_Floy_2018-01-04T15:29:19.000630 | 1,515,079,759.00063 | 27,736 |
pythondev | help | yes it is | 2018-01-04T15:30:24.000540 | Alecia | pythondev_help_Alecia_2018-01-04T15:30:24.000540 | 1,515,079,824.00054 | 27,737 |
pythondev | help | app.layout = html.Div([
html.Label('Multi-Select Dropdown'),
dcc.Dropdown(
id = 'List',
options=[
{'label': 'New York City', 'value': 'NYC'},
{'label': u'Montreal', 'value': 'MTL'},
{'label': 'San Francisco', 'value': 'SF'}
],
value=['MTL', 'SF... | 2018-01-04T16:02:12.000633 | Ji | pythondev_help_Ji_2018-01-04T16:02:12.000633 | 1,515,081,732.000633 | 27,738 |
pythondev | help | I have that code - and I want to see what value has been selected? | 2018-01-04T16:02:34.000410 | Ji | pythondev_help_Ji_2018-01-04T16:02:34.000410 | 1,515,081,754.00041 | 27,739 |
pythondev | help | <@Ji> going to need more info about what that code is for | 2018-01-04T16:06:00.000342 | Floy | pythondev_help_Floy_2018-01-04T16:06:00.000342 | 1,515,081,960.000342 | 27,740 |
pythondev | help | eg, what framework, packages, etc are you using | 2018-01-04T16:06:17.000206 | Floy | pythondev_help_Floy_2018-01-04T16:06:17.000206 | 1,515,081,977.000206 | 27,741 |
pythondev | help | you’re just pushing out a code block with zero context | 2018-01-04T16:06:32.000190 | Floy | pythondev_help_Floy_2018-01-04T16:06:32.000190 | 1,515,081,992.00019 | 27,742 |
pythondev | help | essentially its a multi-select dropdown, and I'm using the values they select into a table to get those values | 2018-01-04T16:06:42.000003 | Ji | pythondev_help_Ji_2018-01-04T16:06:42.000003 | 1,515,082,002.000003 | 27,743 |
pythondev | help | while you may be familiar with the code, please keep in mind we’re not | 2018-01-04T16:06:47.000370 | Floy | pythondev_help_Floy_2018-01-04T16:06:47.000370 | 1,515,082,007.00037 | 27,744 |
pythondev | help | but I'm not able to figure out how to get out the values selected in the dropdown out | 2018-01-04T16:07:02.000256 | Ji | pythondev_help_Ji_2018-01-04T16:07:02.000256 | 1,515,082,022.000256 | 27,745 |
pythondev | help | so, with something like this, you really have two options.
1. use a html form to post form data to the server, which your code will handle, or
2. implement ajax functionality in javascript to post the update to the server after a select has been made | 2018-01-04T16:08:18.000341 | Floy | pythondev_help_Floy_2018-01-04T16:08:18.000341 | 1,515,082,098.000341 | 27,746 |
pythondev | help | so that's not a problem - I'm using dash library and it does 1 for me | 2018-01-04T16:09:08.000191 | Ji | pythondev_help_Ji_2018-01-04T16:09:08.000191 | 1,515,082,148.000191 | 27,747 |
pythondev | help | but I'm outputting something based on the input (all the drop-downs selected) - and I want to get that back but not able to figure out how | 2018-01-04T16:10:43.000218 | Ji | pythondev_help_Ji_2018-01-04T16:10:43.000218 | 1,515,082,243.000218 | 27,748 |
pythondev | help | sorry, don’t know dash at all | 2018-01-04T16:12:02.000520 | Floy | pythondev_help_Floy_2018-01-04T16:12:02.000520 | 1,515,082,322.00052 | 27,749 |
pythondev | help | how does Python keep references to an object? I have the following code with weird behaviour:
```
object_list = []
for row in invoices:
object_list.append(InvoiceParser(data=row))
```
When I check `object_list` afterwards, EVERY InvoiceParser shows the data of the last row… | 2018-01-05T03:51:33.000025 | Euna | pythondev_help_Euna_2018-01-05T03:51:33.000025 | 1,515,124,293.000025 | 27,750 |
pythondev | help | thanks <@Monroe> will have a check through | 2018-01-05T04:26:12.000024 | Milo | pythondev_help_Milo_2018-01-05T04:26:12.000024 | 1,515,126,372.000024 | 27,751 |
pythondev | help | <@Euna> <https://repl.it/repls/WiltedIndolentClam> | 2018-01-05T05:16:08.000214 | Aleida | pythondev_help_Aleida_2018-01-05T05:16:08.000214 | 1,515,129,368.000214 | 27,752 |
pythondev | help | What is `invoices`? | 2018-01-05T05:16:20.000216 | Aleida | pythondev_help_Aleida_2018-01-05T05:16:20.000216 | 1,515,129,380.000216 | 27,753 |
pythondev | help | <@Aleida> it’s a list of dictionaries with data from an external API | 2018-01-05T05:24:52.000009 | Euna | pythondev_help_Euna_2018-01-05T05:24:52.000009 | 1,515,129,892.000009 | 27,754 |
pythondev | help | I doubt that. Can you show its `repr`? | 2018-01-05T05:27:54.000301 | Aleida | pythondev_help_Aleida_2018-01-05T05:27:54.000301 | 1,515,130,074.000301 | 27,755 |
pythondev | help | hmm, I’ll try | 2018-01-05T05:28:29.000262 | Euna | pythondev_help_Euna_2018-01-05T05:28:29.000262 | 1,515,130,109.000262 | 27,756 |
pythondev | help | <@Aleida> I made a small snippet that reproduces my issue, maybe that makes it a little bit more clear.. <https://repl.it/repls/VoluminousKnownAndeancondor> | 2018-01-05T05:35:06.000160 | Euna | pythondev_help_Euna_2018-01-05T05:35:06.000160 | 1,515,130,506.00016 | 27,757 |
pythondev | help | <@Euna> In your example `field1` is a class variable rather than an instance variable right? | 2018-01-05T05:46:12.000332 | Cecila | pythondev_help_Cecila_2018-01-05T05:46:12.000332 | 1,515,131,172.000332 | 27,758 |
pythondev | help | So every instance of the class will have the exact same Field object as it is actually on the class not the instance | 2018-01-05T05:49:56.000029 | Cecila | pythondev_help_Cecila_2018-01-05T05:49:56.000029 | 1,515,131,396.000029 | 27,759 |
pythondev | help | Is there a possibility to have a `where` clause on a for loop? My CTO who is a C# dev says there is one, I think not! | 2018-01-05T05:50:59.000198 | Milo | pythondev_help_Milo_2018-01-05T05:50:59.000198 | 1,515,131,459.000198 | 27,760 |
pythondev | help | hi guys, I’m writing an internal lib for our projects.
I’m try to use logger, my intention is to, try to get a default logger like logging.get(__name__). If there’re no file attached to it, it will print log into my particular file eg `srv/projects1/my_library.log`
Is that a best practice to do? How can we archived tha... | 2018-01-05T05:51:55.000181 | Ben | pythondev_help_Ben_2018-01-05T05:51:55.000181 | 1,515,131,515.000181 | 27,761 |
pythondev | help | <@Cecila> is correct. | 2018-01-05T05:53:54.000064 | Aleida | pythondev_help_Aleida_2018-01-05T05:53:54.000064 | 1,515,131,634.000064 | 27,762 |
pythondev | help | like this
```logger = logging.get(__name__)
if logger is not attached to file:
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
filename='/srv/logs/my_library.log')
``` | 2018-01-05T05:54:33.000174 | Ben | pythondev_help_Ben_2018-01-05T05:54:33.000174 | 1,515,131,673.000174 | 27,763 |
pythondev | help | I have a list of tuples that I am looping through getting data according to values for parents and children, I have accomplished this fine, however now I am having difficulty mapping each child to parent. Should I use a dictionary or a list? So for example, what I want to append is something like this structure;
```
S... | 2018-01-05T07:09:23.000142 | Milo | pythondev_help_Milo_2018-01-05T07:09:23.000142 | 1,515,136,163.000142 | 27,764 |
pythondev | help | <@Milo> got some code? | 2018-01-05T07:17:00.000013 | Harrison | pythondev_help_Harrison_2018-01-05T07:17:00.000013 | 1,515,136,620.000013 | 27,765 |
pythondev | help | forgot to mentions sector can have multiple children! | 2018-01-05T07:17:15.000096 | Milo | pythondev_help_Milo_2018-01-05T07:17:15.000096 | 1,515,136,635.000096 | 27,766 |
pythondev | help | <@Harrison> trying to conjure something up now thinking a dictionary might be fit for purpose. | 2018-01-05T07:17:55.000128 | Milo | pythondev_help_Milo_2018-01-05T07:17:55.000128 | 1,515,136,675.000128 | 27,767 |
pythondev | help | will get some code posted | 2018-01-05T07:18:02.000111 | Milo | pythondev_help_Milo_2018-01-05T07:18:02.000111 | 1,515,136,682.000111 | 27,768 |
pythondev | help | you kinda answered your own question: “mapping”, this usually translates into a dictionary | 2018-01-05T07:19:08.000217 | Harrison | pythondev_help_Harrison_2018-01-05T07:19:08.000217 | 1,515,136,748.000217 | 27,769 |
pythondev | help | do we have a :taco: counter now? lol | 2018-01-05T07:23:28.000246 | Harrison | pythondev_help_Harrison_2018-01-05T07:23:28.000246 | 1,515,137,008.000246 | 27,770 |
pythondev | help | yup the problem is I can't figure out how to append more than child of sector, there can be multiple children of sector | 2018-01-05T07:24:16.000145 | Milo | pythondev_help_Milo_2018-01-05T07:24:16.000145 | 1,515,137,056.000145 | 27,771 |
pythondev | help | sounds like what you want is a B+ tree structure | 2018-01-05T07:27:20.000129 | Floy | pythondev_help_Floy_2018-01-05T07:27:20.000129 | 1,515,137,240.000129 | 27,772 |
pythondev | help | <https://github.com/apeeyush/BPlusTree> | 2018-01-05T07:28:29.000068 | Floy | pythondev_help_Floy_2018-01-05T07:28:29.000068 | 1,515,137,309.000068 | 27,773 |
pythondev | help | <https://en.wikipedia.org/wiki/B%2B_tree> | 2018-01-05T07:28:48.000221 | Floy | pythondev_help_Floy_2018-01-05T07:28:48.000221 | 1,515,137,328.000221 | 27,774 |
pythondev | help | Hmm, i see. What is the best way how I can define “Fields” for a Parser like in the example? I want to easy for other developers to create different parsers with fields (and field options) | 2018-01-05T07:34:46.000059 | Euna | pythondev_help_Euna_2018-01-05T07:34:46.000059 | 1,515,137,686.000059 | 27,775 |
pythondev | help | I am not sure but perhaps look at something like Django’s implementation for Forms will give you some direction? <https://github.com/django/django/blob/master/django/forms/forms.py#L491> | 2018-01-05T09:00:40.000120 | Cecila | pythondev_help_Cecila_2018-01-05T09:00:40.000120 | 1,515,142,840.00012 | 27,776 |
pythondev | help | Can anyone help me figure out this error
```
Jan 05 14:25:38 ubuntu elasticsearch[6922]: java.io.FileNotFoundException: /var/run/elasticsearch/elasticsearch.pid (No such file or directory)
Jan 05 14:25:38 ubuntu elasticsearch[6922]: at java.io.FileOutputStream.open0(Native Method)
Jan 05 14:25:38 ubuntu elasti... | 2018-01-05T09:30:49.000442 | Tanesha | pythondev_help_Tanesha_2018-01-05T09:30:49.000442 | 1,515,144,649.000442 | 27,777 |
pythondev | help | More information over at <#C0LMFRMB5|django> | 2018-01-05T09:31:45.000478 | Tanesha | pythondev_help_Tanesha_2018-01-05T09:31:45.000478 | 1,515,144,705.000478 | 27,778 |
pythondev | help | Hey guys.
I got a django project running locally on a postgresql server but every day I seem to have problems with starting the server or logging on. The password isn't authenticated.
Is there something I'm missing? Just started working with postgresql a couple of days ago..
```psql: FATAL: password authentication... | 2018-01-05T09:44:04.000377 | Billy | pythondev_help_Billy_2018-01-05T09:44:04.000377 | 1,515,145,444.000377 | 27,779 |
pythondev | help | I can't connect with other users either. I got one called "emanuel" | 2018-01-05T09:46:44.000224 | Billy | pythondev_help_Billy_2018-01-05T09:46:44.000224 | 1,515,145,604.000224 | 27,780 |
pythondev | help | and that's not working either. | 2018-01-05T09:46:51.000352 | Billy | pythondev_help_Billy_2018-01-05T09:46:51.000352 | 1,515,145,611.000352 | 27,781 |
pythondev | help | <@Tanesha> what version elasticsearch? | 2018-01-05T09:57:42.000556 | Floy | pythondev_help_Floy_2018-01-05T09:57:42.000556 | 1,515,146,262.000556 | 27,782 |
pythondev | help | <https://github.com/elastic/elasticsearch/issues/11594> | 2018-01-05T09:57:46.000537 | Floy | pythondev_help_Floy_2018-01-05T09:57:46.000537 | 1,515,146,266.000537 | 27,783 |
pythondev | help | <@Billy> Are you wanting to connect without supplying the password to postgres? If so you will have to change your `pg_hba.conf` config file to allow the `trust` method for that user or db | 2018-01-05T09:58:08.000022 | Cecila | pythondev_help_Cecila_2018-01-05T09:58:08.000022 | 1,515,146,288.000022 | 27,784 |
pythondev | help | <@Floy> cant seem to get the version up. | 2018-01-05T10:00:14.000365 | Tanesha | pythondev_help_Tanesha_2018-01-05T10:00:14.000365 | 1,515,146,414.000365 | 27,785 |
pythondev | help | try this | 2018-01-05T10:01:33.000521 | Floy | pythondev_help_Floy_2018-01-05T10:01:33.000521 | 1,515,146,493.000521 | 27,786 |
pythondev | help | <https://serverfault.com/a/765769> | 2018-01-05T10:01:33.000523 | Floy | pythondev_help_Floy_2018-01-05T10:01:33.000523 | 1,515,146,493.000523 | 27,787 |
pythondev | help | <@Floy>
```{
"status" : 200,
"name" : "Electron",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.7.2",
"build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
"build_timestamp" : "2015-09-14T09:49:53Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline"... | 2018-01-05T10:10:59.000174 | Tanesha | pythondev_help_Tanesha_2018-01-05T10:10:59.000174 | 1,515,147,059.000174 | 27,788 |
pythondev | help | <@Floy> It doesn't matter pall, ill just wait for the guy who created the system. | 2018-01-05T10:14:20.000703 | Tanesha | pythondev_help_Tanesha_2018-01-05T10:14:20.000703 | 1,515,147,260.000703 | 27,789 |
pythondev | help | ha ok. hope he gets back fast | 2018-01-05T10:15:27.000142 | Floy | pythondev_help_Floy_2018-01-05T10:15:27.000142 | 1,515,147,327.000142 | 27,790 |
pythondev | help | butthat’s a fairly old build | 2018-01-05T10:15:34.000244 | Floy | pythondev_help_Floy_2018-01-05T10:15:34.000244 | 1,515,147,334.000244 | 27,791 |
pythondev | help | I know I can do that to edit my password/user or add another user but I'm guessing that user and password will also stop working as did the two last I created. Dunno what I'm missing. :disappointed: | 2018-01-05T10:25:31.000676 | Billy | pythondev_help_Billy_2018-01-05T10:25:31.000676 | 1,515,147,931.000676 | 27,792 |
pythondev | help | I'm running postgresql 10 | 2018-01-05T10:25:42.000200 | Billy | pythondev_help_Billy_2018-01-05T10:25:42.000200 | 1,515,147,942.0002 | 27,793 |
pythondev | help | ok, nvm. The default is set for version 9.6 that's also installed. Have to change it to v.10. | 2018-01-05T10:28:41.000641 | Billy | pythondev_help_Billy_2018-01-05T10:28:41.000641 | 1,515,148,121.000641 | 27,794 |
pythondev | help | Anyone ever get python to use boto3 with the roles from a machine versus sending key/value to access a s3 bucket? | 2018-01-05T13:18:06.000162 | Daron | pythondev_help_Daron_2018-01-05T13:18:06.000162 | 1,515,158,286.000162 | 27,795 |
pythondev | help | if so, any examples? | 2018-01-05T13:18:22.000269 | Daron | pythondev_help_Daron_2018-01-05T13:18:22.000269 | 1,515,158,302.000269 | 27,796 |
pythondev | help | Hi! I need to translate a string in accordance with the language to the browser, but is a dynamic string Is format for "Hola! Como estas %s" % ( name ) ?
I try but i can do to work. In English i have to stay "Hi! How are you Mery? " and in Spanish "Hola! Como estas Mery?" | 2018-01-05T13:19:00.000198 | Oneida | pythondev_help_Oneida_2018-01-05T13:19:00.000198 | 1,515,158,340.000198 | 27,797 |
pythondev | help | <@Daron> you mean uploading files to S3? | 2018-01-05T13:19:32.000134 | Floy | pythondev_help_Floy_2018-01-05T13:19:32.000134 | 1,515,158,372.000134 | 27,798 |
pythondev | help | <@Oneida> are you using a framework? | 2018-01-05T13:20:09.000009 | Floy | pythondev_help_Floy_2018-01-05T13:20:09.000009 | 1,515,158,409.000009 | 27,799 |
pythondev | help | Actually I am just trying to search for a bucket with the role | 2018-01-05T13:20:10.000389 | Daron | pythondev_help_Daron_2018-01-05T13:20:10.000389 | 1,515,158,410.000389 | 27,800 |
pythondev | help | for example, django allows you to add in translations | 2018-01-05T13:20:46.000119 | Floy | pythondev_help_Floy_2018-01-05T13:20:46.000119 | 1,515,158,446.000119 | 27,801 |
pythondev | help | <https://docs.djangoproject.com/en/2.0/topics/i18n/translation/> | 2018-01-05T13:20:47.000065 | Floy | pythondev_help_Floy_2018-01-05T13:20:47.000065 | 1,515,158,447.000065 | 27,802 |
pythondev | help | sounds pretty simple, tbh | 2018-01-05T13:21:14.000209 | Floy | pythondev_help_Floy_2018-01-05T13:21:14.000209 | 1,515,158,474.000209 | 27,803 |
pythondev | help | as long as you already know the bucket names | 2018-01-05T13:21:38.000290 | Floy | pythondev_help_Floy_2018-01-05T13:21:38.000290 | 1,515,158,498.00029 | 27,804 |
pythondev | help | I do know the bucket name that if falls under just need to verify a new bucket was added under it. | 2018-01-05T13:22:23.000082 | Daron | pythondev_help_Daron_2018-01-05T13:22:23.000082 | 1,515,158,543.000082 | 27,805 |
pythondev | help | I was attempting to use as a template <https://github.com/aws-samples/aws-python-sample/blob/master/s3_sample.py>
But getting ```botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:sts::2xxxx2:assumed-role/Role/i-096e19fd is not authorized to perform: s... | 2018-01-05T13:24:00.000459 | Daron | pythondev_help_Daron_2018-01-05T13:24:00.000459 | 1,515,158,640.000459 | 27,806 |
pythondev | help | <@Floy> I am using django but i can the reason that not translate... I have the po with the variable and without the variable | 2018-01-05T13:27:29.000119 | Oneida | pythondev_help_Oneida_2018-01-05T13:27:29.000119 | 1,515,158,849.000119 | 27,807 |
pythondev | help | Solve. I was doing wrong. I was asigne the name to %s before traslate so never found the traslate | 2018-01-05T13:36:56.000257 | Oneida | pythondev_help_Oneida_2018-01-05T13:36:56.000257 | 1,515,159,416.000257 | 27,808 |
pythondev | help | Sorry | 2018-01-05T13:36:59.000399 | Oneida | pythondev_help_Oneida_2018-01-05T13:36:59.000399 | 1,515,159,419.000399 | 27,809 |
pythondev | help | ah, nice! | 2018-01-05T13:37:05.000574 | Floy | pythondev_help_Floy_2018-01-05T13:37:05.000574 | 1,515,159,425.000574 | 27,810 |
pythondev | help | FYI, we have a <#C0LMFRMB5|django> channel | 2018-01-05T13:37:21.000046 | Floy | pythondev_help_Floy_2018-01-05T13:37:21.000046 | 1,515,159,441.000046 | 27,811 |
pythondev | help | <@Floy> Thank you!! | 2018-01-05T13:42:39.000073 | Oneida | pythondev_help_Oneida_2018-01-05T13:42:39.000073 | 1,515,159,759.000073 | 27,812 |
pythondev | help | Two lists:
```
x = [0, 0, 1, 2, 0, 1]
y = ["Joe", "Bob, "Jim, "Hue", "Dan", "Jan"]
```
I want to create a string that looks like this:
```"Joe, Bob, Jim (+1), Hue (+2), Dan, Jan (+1)"```
Best way to achieve this? | 2018-01-05T14:35:32.000390 | Majorie | pythondev_help_Majorie_2018-01-05T14:35:32.000390 | 1,515,162,932.00039 | 27,813 |
pythondev | help | `zip` | 2018-01-05T14:36:58.000202 | Garrett | pythondev_help_Garrett_2018-01-05T14:36:58.000202 | 1,515,163,018.000202 | 27,814 |
pythondev | help | and some logic | 2018-01-05T14:37:04.000414 | Garrett | pythondev_help_Garrett_2018-01-05T14:37:04.000414 | 1,515,163,024.000414 | 27,815 |
pythondev | help | I'm struggling with the logic part, how can I add an if x[i].
My original thought was so do something like `[n + "(+{})".format(x[i]) for i, n in enumerate[y] if x[i]]` | 2018-01-05T14:40:45.000558 | Majorie | pythondev_help_Majorie_2018-01-05T14:40:45.000558 | 1,515,163,245.000558 | 27,816 |
pythondev | help | but that would only return ["Jim(+1)", "Hue(+2)", "Jan(+1)"] | 2018-01-05T14:41:38.000439 | Majorie | pythondev_help_Majorie_2018-01-05T14:41:38.000439 | 1,515,163,298.000439 | 27,817 |
pythondev | help | I'm having a brain fart, I know there is an easier way to do this. | 2018-01-05T14:41:57.000606 | Majorie | pythondev_help_Majorie_2018-01-05T14:41:57.000606 | 1,515,163,317.000606 | 27,818 |
pythondev | help | wait, can I have an `else` in a list comp? | 2018-01-05T14:43:36.000377 | Majorie | pythondev_help_Majorie_2018-01-05T14:43:36.000377 | 1,515,163,416.000377 | 27,819 |
pythondev | help | you can | 2018-01-05T14:44:59.000111 | Sheldon | pythondev_help_Sheldon_2018-01-05T14:44:59.000111 | 1,515,163,499.000111 | 27,820 |
pythondev | help | `", ".join(['{N} (+{I})'.format(I=x[i],N=n) if x[i]!=0 else n for i,n in enumerate(y)])` | 2018-01-05T14:45:10.000224 | Sheldon | pythondev_help_Sheldon_2018-01-05T14:45:10.000224 | 1,515,163,510.000224 | 27,821 |
pythondev | help | `", ".join([name + " (+{})".format(votes) if votes > 0 else name for votes, name in zip(x, y)])` | 2018-01-05T14:45:28.000345 | Garrett | pythondev_help_Garrett_2018-01-05T14:45:28.000345 | 1,515,163,528.000345 | 27,822 |
pythondev | help | you don't need `enumerate` for this at all | 2018-01-05T14:45:34.000112 | Garrett | pythondev_help_Garrett_2018-01-05T14:45:34.000112 | 1,515,163,534.000112 | 27,823 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.