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 dnt have iostat on my freebsd system | 2017-12-05T09:22:05.000034 | Sara | pythondev_help_Sara_2017-12-05T09:22:05.000034 | 1,512,465,725.000034 | 102,203 |
pythondev | help | its part of BSD base installs ¯\_(ツ)_/¯ | 2017-12-05T09:23:27.000535 | Patty | pythondev_help_Patty_2017-12-05T09:23:27.000535 | 1,512,465,807.000535 | 102,204 |
pythondev | help | buts mine is customised one so not all the libs are present | 2017-12-05T09:24:09.000232 | Sara | pythondev_help_Sara_2017-12-05T09:24:09.000232 | 1,512,465,849.000232 | 102,205 |
pythondev | help | Anybody ever seen this pycharm issue? | 2017-12-05T10:14:00.000429 | Glinda | pythondev_help_Glinda_2017-12-05T10:14:00.000429 | 1,512,468,840.000429 | 102,206 |
pythondev | help | any dropdown on click is detached | 2017-12-05T10:14:18.000873 | Glinda | pythondev_help_Glinda_2017-12-05T10:14:18.000873 | 1,512,468,858.000873 | 102,207 |
pythondev | help | Unless I'm on my primary monitor, setup is left top, left bot (primary) right middle | 2017-12-05T10:14:48.000867 | Glinda | pythondev_help_Glinda_2017-12-05T10:14:48.000867 | 1,512,468,888.000867 | 102,208 |
pythondev | help | nope.. that’s really weird | 2017-12-05T10:15:24.000099 | Meg | pythondev_help_Meg_2017-12-05T10:15:24.000099 | 1,512,468,924.000099 | 102,209 |
pythondev | help | what version pycharm? | 2017-12-05T10:15:34.000066 | Meg | pythondev_help_Meg_2017-12-05T10:15:34.000066 | 1,512,468,934.000066 | 102,210 |
pythondev | help | newest, proffessional | 2017-12-05T10:15:44.000049 | Glinda | pythondev_help_Glinda_2017-12-05T10:15:44.000049 | 1,512,468,944.000049 | 102,211 |
pythondev | help | before updating to 2017.3 2017.2 did same. | 2017-12-05T10:16:08.000109 | Glinda | pythondev_help_Glinda_2017-12-05T10:16:08.000109 | 1,512,468,968.000109 | 102,212 |
pythondev | help | :thinking_face: | 2017-12-05T10:16:19.000853 | Meg | pythondev_help_Meg_2017-12-05T10:16:19.000853 | 1,512,468,979.000853 | 102,213 |
pythondev | help | what os? | 2017-12-05T10:16:27.000142 | Meg | pythondev_help_Meg_2017-12-05T10:16:27.000142 | 1,512,468,987.000142 | 102,214 |
pythondev | help | windows, dell laptop, video connection through usb-c docking. | 2017-12-05T10:17:49.000133 | Glinda | pythondev_help_Glinda_2017-12-05T10:17:49.000133 | 1,512,469,069.000133 | 102,215 |
pythondev | help | Only program I've had this issue with is pycharm | 2017-12-05T10:18:06.000331 | Glinda | pythondev_help_Glinda_2017-12-05T10:18:06.000331 | 1,512,469,086.000331 | 102,216 |
pythondev | help | I looked through their issues yesterday and didn't see anything like it. | 2017-12-05T10:18:24.000031 | Glinda | pythondev_help_Glinda_2017-12-05T10:18:24.000031 | 1,512,469,104.000031 | 102,217 |
pythondev | help | I run pycharm/webstorm in the upper right one | 2017-12-05T10:18:48.000435 | Meg | pythondev_help_Meg_2017-12-05T10:18:48.000435 | 1,512,469,128.000435 | 102,218 |
pythondev | help | Really frustrating because I really want to run pycharm in the top left. | 2017-12-05T10:19:01.000290 | Glinda | pythondev_help_Glinda_2017-12-05T10:19:01.000290 | 1,512,469,141.00029 | 102,219 |
pythondev | help | think it might be the dock? can you run vga out and hdmi just for comparison? | 2017-12-05T10:19:36.000119 | Meg | pythondev_help_Meg_2017-12-05T10:19:36.000119 | 1,512,469,176.000119 | 102,220 |
pythondev | help | mini display port to vga cable on right monitor; dvi -> dvi on top left. | 2017-12-05T10:20:59.000312 | Glinda | pythondev_help_Glinda_2017-12-05T10:20:59.000312 | 1,512,469,259.000312 | 102,221 |
pythondev | help | I don't have other cables around. | 2017-12-05T10:21:07.000279 | Glinda | pythondev_help_Glinda_2017-12-05T10:21:07.000279 | 1,512,469,267.000279 | 102,222 |
pythondev | help | I'll probably submit an issue to the repository. | 2017-12-05T10:22:26.000447 | Glinda | pythondev_help_Glinda_2017-12-05T10:22:26.000447 | 1,512,469,346.000447 | 102,223 |
pythondev | help | <@Glinda> try passing -Dsun.java2d.uiScale.enabled=false VM option to PyCharm (in vmoptions file: Help > Edit custom VM options). | 2017-12-05T10:46:32.000285 | Patty | pythondev_help_Patty_2017-12-05T10:46:32.000285 | 1,512,470,792.000285 | 102,224 |
pythondev | help | if that doesnt work there are already several issues opened around this: <https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000134584-When-using-multiple-monitors-popup-windows-and-context-menus-are-not-positioned-correctly-> | 2017-12-05T10:47:28.000507 | Patty | pythondev_help_Patty_2017-12-05T10:47:28.000507 | 1,512,470,848.000507 | 102,225 |
pythondev | help | That worked. | 2017-12-05T10:48:04.000018 | Glinda | pythondev_help_Glinda_2017-12-05T10:48:04.000018 | 1,512,470,884.000018 | 102,226 |
pythondev | help | Even more interesting is that it didn't happen with clion | 2017-12-05T10:48:54.000453 | Glinda | pythondev_help_Glinda_2017-12-05T10:48:54.000453 | 1,512,470,934.000453 | 102,227 |
pythondev | help | It may be because one resided on two monitors at some point, that makes Jetbrains IDEs wonky | 2017-12-05T10:49:44.000268 | Patty | pythondev_help_Patty_2017-12-05T10:49:44.000268 | 1,512,470,984.000268 | 102,228 |
pythondev | help | Thanks for your help, been dealing with it for a while. did you use intellij search for that or something else? I searched for a bunchof variations yesterday and didn't find appropriate issues. | 2017-12-05T10:51:48.000605 | Glinda | pythondev_help_Glinda_2017-12-05T10:51:48.000605 | 1,512,471,108.000605 | 102,229 |
pythondev | help | Just googled “intellij dropdown menu not in correct location” | 2017-12-05T10:53:46.000532 | Patty | pythondev_help_Patty_2017-12-05T10:53:46.000532 | 1,512,471,226.000532 | 102,230 |
pythondev | help | anyone using aws lambda? | 2017-12-05T10:55:17.000536 | Lashell | pythondev_help_Lashell_2017-12-05T10:55:17.000536 | 1,512,471,317.000536 | 102,231 |
pythondev | help | <@Lashell> Yep, a few of us do, what’s up? | 2017-12-05T10:57:58.000435 | Patty | pythondev_help_Patty_2017-12-05T10:57:58.000435 | 1,512,471,478.000435 | 102,232 |
pythondev | help | I’ve never used it before, but I am considering trying it out. I just have a simple express server that I am using as an http proxy for an api (requests to my api will go through this proxy server so that I can hide the api key from the public). Is this a good use case for using aws lambda, or is there a better option... | 2017-12-05T11:06:50.000172 | Lashell | pythondev_help_Lashell_2017-12-05T11:06:50.000172 | 1,512,472,010.000172 | 102,233 |
pythondev | help | So you want to use lambda to host a proxy for all of the calls? | 2017-12-05T11:09:17.000257 | Patty | pythondev_help_Patty_2017-12-05T11:09:17.000257 | 1,512,472,157.000257 | 102,234 |
pythondev | help | yes | 2017-12-05T11:10:49.000635 | Lashell | pythondev_help_Lashell_2017-12-05T11:10:49.000635 | 1,512,472,249.000635 | 102,235 |
pythondev | help | You’d have to set up a proper trigger, probably with an API Gateway (<https://aws.amazon.com/api-gateway/>) but if this is going to be proxying every call, the lambda is going to be called a lot, which is not going to be cheap | 2017-12-05T11:10:56.000107 | Patty | pythondev_help_Patty_2017-12-05T11:10:56.000107 | 1,512,472,256.000107 | 102,236 |
pythondev | help | Depending on the load, you are probably better off running a small instance on EC2 or whatever you prefer to host the proxy | 2017-12-05T11:11:17.000858 | Patty | pythondev_help_Patty_2017-12-05T11:11:17.000858 | 1,512,472,277.000858 | 102,237 |
pythondev | help | but if its low enough load, it may be cheaper for the lambda, depending on how long that lambda takes to run | 2017-12-05T11:12:40.000237 | Patty | pythondev_help_Patty_2017-12-05T11:12:40.000237 | 1,512,472,360.000237 | 102,238 |
pythondev | help | I don’t expect the calls to be too frequent. But I think you’re right that it would probably be cheaper using an ec2 instance. | 2017-12-05T11:13:23.000387 | Lashell | pythondev_help_Lashell_2017-12-05T11:13:23.000387 | 1,512,472,403.000387 | 102,239 |
pythondev | help | Well, if it’s light enough, then it’s not cheaper | 2017-12-05T11:13:37.000720 | Patty | pythondev_help_Patty_2017-12-05T11:13:37.000720 | 1,512,472,417.00072 | 102,240 |
pythondev | help | Just don't try to setup lambda manually. Use a framework, like serverless (<https://github.com/serverless/serverless>) | 2017-12-05T11:14:52.000172 | Collette | pythondev_help_Collette_2017-12-05T11:14:52.000172 | 1,512,472,492.000172 | 102,241 |
pythondev | help | I had to do that once, for two dependent functions, using cloudformation, and it was a nightmare | 2017-12-05T11:15:20.000313 | Collette | pythondev_help_Collette_2017-12-05T11:15:20.000313 | 1,512,472,520.000313 | 102,242 |
pythondev | help | thanks <@Collette> i was looking for that | 2017-12-05T11:15:40.000357 | Patty | pythondev_help_Patty_2017-12-05T11:15:40.000357 | 1,512,472,540.000357 | 102,243 |
pythondev | help | Is lambda free tier eligible? I know that I could get 1 year free using the ec2 instance. | 2017-12-05T11:15:45.000498 | Lashell | pythondev_help_Lashell_2017-12-05T11:15:45.000498 | 1,512,472,545.000498 | 102,244 |
pythondev | help | Is it the same story for using lambda | 2017-12-05T11:15:53.000081 | Lashell | pythondev_help_Lashell_2017-12-05T11:15:53.000081 | 1,512,472,553.000081 | 102,245 |
pythondev | help | <https://aws.amazon.com/lambda/pricing/?nc1=h_ls> | 2017-12-05T11:17:00.000472 | Collette | pythondev_help_Collette_2017-12-05T11:17:00.000472 | 1,512,472,620.000472 | 102,246 |
pythondev | help | Free Tier
1M REQUESTS
per month
400 GB-SECONDS
of compute time per month. | 2017-12-05T11:17:08.000393 | Collette | pythondev_help_Collette_2017-12-05T11:17:08.000393 | 1,512,472,628.000393 | 102,247 |
pythondev | help | wow 1M requests | 2017-12-05T11:18:11.000463 | Lashell | pythondev_help_Lashell_2017-12-05T11:18:11.000463 | 1,512,472,691.000463 | 102,248 |
pythondev | help | Thanks for the information | 2017-12-05T11:21:37.000099 | Lashell | pythondev_help_Lashell_2017-12-05T11:21:37.000099 | 1,512,472,897.000099 | 102,249 |
pythondev | help | Does anyone know the best way to go about matching likeness of strings? We have a large dict of string mappings for `correct_input : known_incorrect_inputs`. I want to compare these input strings against all values for each key and determine which `correct_input` key had the most likeness based on the values it mapped ... | 2017-12-05T11:49:13.000866 | Myong | pythondev_help_Myong_2017-12-05T11:49:13.000866 | 1,512,474,553.000866 | 102,250 |
pythondev | help | Something like sequence matcher? | 2017-12-05T11:50:33.000541 | Myong | pythondev_help_Myong_2017-12-05T11:50:33.000541 | 1,512,474,633.000541 | 102,251 |
pythondev | help | check out levishtein distance | 2017-12-05T11:58:45.000053 | Meg | pythondev_help_Meg_2017-12-05T11:58:45.000053 | 1,512,475,125.000053 | 102,252 |
pythondev | help | <@Meg> that's what seems to be most recommended. I'll look into it. Thanks also <@Joann> | 2017-12-05T12:12:37.000430 | Myong | pythondev_help_Myong_2017-12-05T12:12:37.000430 | 1,512,475,957.00043 | 102,253 |
pythondev | help | PS you don’t need a DB to do it, though its a nice functionality for PG :slightly_smiling_face: | 2017-12-05T12:13:30.000146 | Patty | pythondev_help_Patty_2017-12-05T12:13:30.000146 | 1,512,476,010.000146 | 102,254 |
pythondev | help | np. | 2017-12-05T12:13:39.000194 | Joann | pythondev_help_Joann_2017-12-05T12:13:39.000194 | 1,512,476,019.000194 | 102,255 |
pythondev | help | <@Myong>, semi-related: <https://github.com/seatgeek/fuzzywuzzy> | 2017-12-05T12:13:50.000392 | Winnifred | pythondev_help_Winnifred_2017-12-05T12:13:50.000392 | 1,512,476,030.000392 | 102,256 |
pythondev | help | Saw that one as well. Gonna have to look into them to see what better fits my needs. | 2017-12-05T12:17:01.000036 | Myong | pythondev_help_Myong_2017-12-05T12:17:01.000036 | 1,512,476,221.000036 | 102,257 |
pythondev | help | fuzzywuzzy is levenshtein anyway ¯\_(ツ)_/¯ | 2017-12-05T12:17:37.000030 | Patty | pythondev_help_Patty_2017-12-05T12:17:37.000030 | 1,512,476,257.00003 | 102,258 |
pythondev | help | Might decide to basically take the value list and select highest likeness ration then compare all the picked ones and choose the best match of them all | 2017-12-05T12:17:49.000503 | Myong | pythondev_help_Myong_2017-12-05T12:17:49.000503 | 1,512,476,269.000503 | 102,259 |
pythondev | help | Or average the ration between the whole list? | 2017-12-05T12:18:00.000188 | Myong | pythondev_help_Myong_2017-12-05T12:18:00.000188 | 1,512,476,280.000188 | 102,260 |
pythondev | help | hmmmmm | 2017-12-05T12:18:03.000584 | Myong | pythondev_help_Myong_2017-12-05T12:18:03.000584 | 1,512,476,283.000584 | 102,261 |
pythondev | help | Hello Folks :-),
is there a Json mapper like Jackson for python? Or an easy way to convert a dict into an object?
| 2017-12-05T14:16:07.000806 | Jeffery | pythondev_help_Jeffery_2017-12-05T14:16:07.000806 | 1,512,483,367.000806 | 102,262 |
pythondev | help | there's the built-in `json` module | 2017-12-05T14:16:54.000554 | Frieda | pythondev_help_Frieda_2017-12-05T14:16:54.000554 | 1,512,483,414.000554 | 102,263 |
pythondev | help | and if you’re using django with django rest framework, it allows you to construct the serializer definition. much like jackson, IMO | 2017-12-05T14:19:10.000554 | Meg | pythondev_help_Meg_2017-12-05T14:19:10.000554 | 1,512,483,550.000554 | 102,264 |
pythondev | help | Thank you - i will read the docs | 2017-12-05T14:20:26.000143 | Jeffery | pythondev_help_Jeffery_2017-12-05T14:20:26.000143 | 1,512,483,626.000143 | 102,265 |
pythondev | help | json will do alot, but IIRC it has trouble with dates, so you oftentime have to make a custom handler for that | 2017-12-05T14:25:52.000448 | Meg | pythondev_help_Meg_2017-12-05T14:25:52.000448 | 1,512,483,952.000448 | 102,266 |
pythondev | help | <https://stackoverflow.com/questions/35869985/datetime-datetime-is-not-json-serializable> | 2017-12-05T14:25:53.000431 | Meg | pythondev_help_Meg_2017-12-05T14:25:53.000431 | 1,512,483,953.000431 | 102,267 |
pythondev | help | Great! Thanks for the hint. :-)
I also found this here for mapping json into an object:
<https://stackoverflow.com/questions/6578986/how-to-convert-json-data-into-a-python-object> | 2017-12-05T14:33:18.000516 | Jeffery | pythondev_help_Jeffery_2017-12-05T14:33:18.000516 | 1,512,484,398.000516 | 102,268 |
pythondev | help | I usually serialize to unix time (seconds since epoch) | 2017-12-05T14:33:26.000722 | Junita | pythondev_help_Junita_2017-12-05T14:33:26.000722 | 1,512,484,406.000722 | 102,269 |
pythondev | help | kept in UTC too, it’s sort of a helpful baseline to be able to assume throughout a project | 2017-12-05T14:34:18.000173 | Junita | pythondev_help_Junita_2017-12-05T14:34:18.000173 | 1,512,484,458.000173 | 102,270 |
pythondev | help | So I got the word matching to work quite well. For the most part it picks the correct items, I do wish there were a way to change the weight of suffixes or preffixes on the word though | 2017-12-05T14:39:47.000319 | Myong | pythondev_help_Myong_2017-12-05T14:39:47.000319 | 1,512,484,787.000319 | 102,271 |
pythondev | help | Hi quick question… I want to run a python script from cron to add/modify entries to the /etc/hosts file on Ubuntu, daily. I have never been good at reg ex and struggling this this simple code. I admittedly googled this syntax and don’t completely understand it.
```
with open('/tmp/hoststest', 'r') as hosts_file:
... | 2017-12-05T14:50:09.000380 | Season | pythondev_help_Season_2017-12-05T14:50:09.000380 | 1,512,485,409.00038 | 102,272 |
pythondev | help | have you considered dns instead? | 2017-12-05T15:16:34.000231 | Sirena | pythondev_help_Sirena_2017-12-05T15:16:34.000231 | 1,512,486,994.000231 | 102,273 |
pythondev | help | :slightly_smiling_face: I knew someone would mention that. Yes I would love to use DNS but in this situation I dont have that control | 2017-12-05T15:17:33.000255 | Season | pythondev_help_Season_2017-12-05T15:17:33.000255 | 1,512,487,053.000255 | 102,274 |
pythondev | help | this will serve my needs but for my education, I’d like to understand the regex better | 2017-12-05T15:19:48.000101 | Season | pythondev_help_Season_2017-12-05T15:19:48.000101 | 1,512,487,188.000101 | 102,275 |
pythondev | help | so the pattern is `r'(#StartStoreLocations.*?\n+)(.*)(#EndStoreLocations)'`. what does that pattern do, as you understand it, <@Season>? | 2017-12-05T15:22:11.000549 | Frieda | pythondev_help_Frieda_2017-12-05T15:22:11.000549 | 1,512,487,331.000549 | 102,276 |
pythondev | help | um, I don't think new_hosts_data is defined inside the re.sub function? | 2017-12-05T15:26:03.000293 | Sirena | pythondev_help_Sirena_2017-12-05T15:26:03.000293 | 1,512,487,563.000293 | 102,277 |
pythondev | help | this is pretty convoluted, would you be able to transmit a diff and then use `patch` to apply it to your /etc/hosts? | 2017-12-05T15:27:00.000616 | Sirena | pythondev_help_Sirena_2017-12-05T15:27:00.000616 | 1,512,487,620.000616 | 102,278 |
pythondev | help | its there and sort of working, I jsut must have a problem with my regex because its putting the data inside the file but not replacing the starting and ending tags. so it replaces
```
#StartStoreLocations
10.242.90.195 VN0394
#EndStoreLocations
```
With
```
#StartStoreLocations
#StartStoreLocations
10.242.90.195 ... | 2017-12-05T15:30:23.000536 | Season | pythondev_help_Season_2017-12-05T15:30:23.000536 | 1,512,487,823.000536 | 102,279 |
pythondev | help | it seems to me like new_hosts_data already has the tags, so you're inserting them between the literal tags in your regex | 2017-12-05T15:31:01.000103 | Sirena | pythondev_help_Sirena_2017-12-05T15:31:01.000103 | 1,512,487,861.000103 | 102,280 |
pythondev | help | that's just a guess | 2017-12-05T15:31:05.000250 | Sirena | pythondev_help_Sirena_2017-12-05T15:31:05.000250 | 1,512,487,865.00025 | 102,281 |
pythondev | help | yes that exactly what happening. I just cant figure out how to fix it | 2017-12-05T15:31:57.000027 | Season | pythondev_help_Season_2017-12-05T15:31:57.000027 | 1,512,487,917.000027 | 102,282 |
pythondev | help | ```new_hosts_data = '#nhdtag\ninfo\#nhdtag'
yields:
#StartStoreLocations
#nhdtag
info
#nhdtag
#EndStoreLocations``` | 2017-12-05T15:32:27.000034 | Sirena | pythondev_help_Sirena_2017-12-05T15:32:27.000034 | 1,512,487,947.000034 | 102,283 |
pythondev | help | you'll fix it with | 2017-12-05T15:32:51.000269 | Sirena | pythondev_help_Sirena_2017-12-05T15:32:51.000269 | 1,512,487,971.000269 | 102,284 |
pythondev | help | `new_hosts_data = re.sub(r'(#StartStoreLocations.*?\n+)(.*)(#EndStoreLocations)', new_hosts_data ,hosts_data, flags=re.M|re.DOTALL)` | 2017-12-05T15:33:11.000404 | Sirena | pythondev_help_Sirena_2017-12-05T15:33:11.000404 | 1,512,487,991.000404 | 102,285 |
pythondev | help | if you want to keep the new_hosts_data tags | 2017-12-05T15:33:21.000750 | Sirena | pythondev_help_Sirena_2017-12-05T15:33:21.000750 | 1,512,488,001.00075 | 102,286 |
pythondev | help | if you want to keep the literals but throw away the new_hosts_data tags, then I'd suggest preprocessing new_hosts_data to drop those lines | 2017-12-05T15:33:57.000261 | Sirena | pythondev_help_Sirena_2017-12-05T15:33:57.000261 | 1,512,488,037.000261 | 102,287 |
pythondev | help | does `#StartStoreLocations` or `#EndStoreLocations` ever change? | 2017-12-05T15:34:33.000125 | Frieda | pythondev_help_Frieda_2017-12-05T15:34:33.000125 | 1,512,488,073.000125 | 102,288 |
pythondev | help | <@Frieda> no | 2017-12-05T15:35:35.000051 | Season | pythondev_help_Season_2017-12-05T15:35:35.000051 | 1,512,488,135.000051 | 102,289 |
pythondev | help | <@Shavonda> that worked except it wiped out the rest of the file with the new data | 2017-12-05T15:36:04.000703 | Season | pythondev_help_Season_2017-12-05T15:36:04.000703 | 1,512,488,164.000703 | 102,290 |
pythondev | help | ? you said the original file only had 3 lines | 2017-12-05T15:36:34.000074 | Sirena | pythondev_help_Sirena_2017-12-05T15:36:34.000074 | 1,512,488,194.000074 | 102,291 |
pythondev | help | at least in your example | 2017-12-05T15:36:40.000344 | Sirena | pythondev_help_Sirena_2017-12-05T15:36:40.000344 | 1,512,488,200.000344 | 102,292 |
pythondev | help | I simplified it. there are other entries in my hosts file. I want to update those. | 2017-12-05T15:37:18.000276 | Season | pythondev_help_Season_2017-12-05T15:37:18.000276 | 1,512,488,238.000276 | 102,293 |
pythondev | help | if they never change, make them non-matching groups and only replace the parts in between | 2017-12-05T15:37:43.000287 | Frieda | pythondev_help_Frieda_2017-12-05T15:37:43.000287 | 1,512,488,263.000287 | 102,294 |
pythondev | help | at it is now, it looks like you're always copying them back in | 2017-12-05T15:37:54.000007 | Frieda | pythondev_help_Frieda_2017-12-05T15:37:54.000007 | 1,512,488,274.000007 | 102,295 |
pythondev | help | thats why I was placing the entries between those tags. here is my current code with your tweaks
```
with open('/etc/hosts', 'r') as hosts_file:
hosts_data = hosts_file.read()
if '#StartStoreLocations' in open('/etc/hosts').read():
new_hosts_file = re.sub(r'(#StartStoreLocations.*?\n+)(.*)(#EndStoreLo... | 2017-12-05T15:38:12.000151 | Season | pythondev_help_Season_2017-12-05T15:38:12.000151 | 1,512,488,292.000151 | 102,296 |
pythondev | help | <@Frieda> agreed, thats what I want to do but I am literally brain dead when it comes to regex. I cant figure out the syntax, which is why I posted here. | 2017-12-05T15:40:37.000383 | Season | pythondev_help_Season_2017-12-05T15:40:37.000383 | 1,512,488,437.000383 | 102,297 |
pythondev | help | if new_hosts_data has the tags, just do:
`new_hosts_file = re.sub(r'#StartStoreLocations.*?\n+(.*)#EndStoreLocations', new_hosts_data ,hosts_data, flags=re.M|re.DOTALL)` | 2017-12-05T15:46:51.000371 | Sirena | pythondev_help_Sirena_2017-12-05T15:46:51.000371 | 1,512,488,811.000371 | 102,298 |
pythondev | help | I personally don't really like that `.*?` because it's slippery, so I might change it to `new_hosts_file = re.sub(r'#StartStoreLocations\s*(.*)#EndStoreLocations', new_hosts_data ,hosts_data, flags=re.M|re.DOTALL)` | 2017-12-05T15:48:44.000220 | Sirena | pythondev_help_Sirena_2017-12-05T15:48:44.000220 | 1,512,488,924.00022 | 102,299 |
pythondev | help | but if you like it, it's sorta personal preference | 2017-12-05T15:49:24.000039 | Sirena | pythondev_help_Sirena_2017-12-05T15:49:24.000039 | 1,512,488,964.000039 | 102,300 |
pythondev | help | I like what works at this point :slightly_smiling_face: trying to wrap my head around it still | 2017-12-05T15:49:44.000260 | Season | pythondev_help_Season_2017-12-05T15:49:44.000260 | 1,512,488,984.00026 | 102,301 |
pythondev | help | can even drop the perens around `(.*)` since you're not using the backrefs any more, but I think they make it easier to read | 2017-12-05T15:51:09.000053 | Sirena | pythondev_help_Sirena_2017-12-05T15:51:09.000053 | 1,512,489,069.000053 | 102,302 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.