Al Sweigart on Nostr: I need to borrow Guido's time machine and add `before()` and `after()` str methods to ...
I need to borrow Guido's time machine and add `before()` and `after()` str methods to Python:
>>> def before(s, q):
... return s[:s.find(q)]
...
>>> def after(s, q):
... return s[s.find(q) + len(q):]
...
>>> before('foobar', 'bar')
'foo'
>>> after('foobar', 'foob')
'ar'
Published at
2024-07-17 16:05:03Event JSON
{
"id": "f9b600cc0073dae0ddb37a3983efa8880cbe6445aae6ab4e8caa94a6891c9dd1",
"pubkey": "89fa96909d343cbebf889f13192e30719623c5102393440d15d51d4b2c08f094",
"created_at": 1721232303,
"kind": 1,
"tags": [
[
"proxy",
"https://mastodon.social/users/AlSweigart/statuses/112802680267770801",
"activitypub"
]
],
"content": "I need to borrow Guido's time machine and add `before()` and `after()` str methods to Python:\n\n\u003e\u003e\u003e def before(s, q):\n... return s[:s.find(q)]\n...\n\u003e\u003e\u003e def after(s, q):\n... return s[s.find(q) + len(q):]\n...\n\u003e\u003e\u003e before('foobar', 'bar')\n'foo'\n\u003e\u003e\u003e after('foobar', 'foob')\n'ar'",
"sig": "2501eb2e9c26ceb64f2f0d0de1293a1fe84cc543791a203b6d3d30d128f012057a92abce18ee1c59684ef0d34fb88a8efa2fc6c453c51a55c551b0933e934b32"
}