@Wooble/

NanoIdleScan

Python

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.23941633149066255","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"bGlzdF9hID0gWydVbml0ZWQgU3RhdGVzOlBHJywgJ1VuaXRlZCBTdGF0ZXM6VFYtUEcnXQpsaXN0X2IgPSBbJ1BHLTEzJywgJ3BnLTEzJywgJ1RWLVknLCAnUEcnLCAncGcnLCAnUicsICdyJywgJ1RWLVBHJywgJ3R2LXBnJ10KCnByaW50KCdsaXN0X2EgYmVmb3JlIHJlcGxhY2VfbGlzdCcsIGxpc3RfYSwgJ1xuJykKCmRlZiByZXBsYWNlX2xpc3QobGlzdF9hLCBsaXN0X2IpOgojICAgIFtzdHJpbmcgZm9yIHN0cmluZyBpbiBsaXN0X2EgaWYgYW55KHN0ciBpbiBzdHJpbmcgZm9yIHN0cmluZyBpbiBsaXN0X2IgKHN0cmluZy5yZXBsYWNlKHN0cmluZywgc3RyKSkpXQogICAgbmV3X2xpc3QgPSBbXQogICAgZm9yIHJhdGluZyBpbiBsaXN0X2E6CiAgICAgIGZvciBzaG9ydF9yYXRpbmcgaW4gbGlzdF9iOgogICAgICAgIGlmIHNob3J0X3JhdGluZyBpbiByYXRpbmc6CiAgICAgICAgICBuZXdfbGlzdC5hcHBlbmQoc2hvcnRfcmF0aW5nKQogICAgICAgICAgYnJlYWsKICAgICAgZWxzZToKICAgICAgICBuZXdfbGlzdC5hcHBlbmQocmF0aW5nKQogICAgbGlzdF9hWzpdID0gbmV3X2xpc3QKCgojICBzbyBJIHdhbnQgdG8gZmluZCBpbiAibGlzdF9hIiB0aGUgc3RyaW5ncyB0aGF0IGFyZSBpbiBsaXN0X2IsCiMgIGFuZCBpZiBpdCBpcyB0aGVyZSByZXBsYWNlIHRoZSBob2xlIHN0cmluZyB3aXRoIHdoYXQgc3RyaW5nIGZvdW5kIGl0IGZyb20gbGlzdF9iLgojICBzbyB0aGUgY2hhbmdlIHNob3VsZCBsb29rIGxpa2UgdGhpcyBpbiB0aGUgZW5kLgojICBsaXN0X2EgPVsnUEcnLCAnVFYtUEcnXQoKcmVwbGFjZV9saXN0KGxpc3RfYSwgbGlzdF9iKQoKcHJpbnQoJ2xpc3RfYSBhZnRlciByZXBsYWNlX2xpc3QnLCBsaXN0X2EsICdcbicp"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
list_a = ['United States:PG', 'United States:TV-PG']
list_b = ['PG-13', 'pg-13', 'TV-Y', 'PG', 'pg', 'R', 'r', 'TV-PG', 'tv-pg']

print('list_a before replace_list', list_a, '\n')

def replace_list(list_a, list_b):
#    [string for string in list_a if any(str in string for string in list_b (string.replace(string, str)))]
    new_list = []
    for rating in list_a:
      for short_rating in list_b:
        if short_rating in rating:
          new_list.append(short_rating)
          break
      else:
        new_list.append(rating)
    list_a[:] = new_list


#  so I want to find in "list_a" the strings that are in list_b,
#  and if it is there replace the hole string with what string found it from list_b.
#  so the change should look like this in the end.
#  list_a =['PG', 'TV-PG']

replace_list(list_a, list_b)

print('list_a after replace_list', list_a, '\n')