Ace-xvi/Generative_AI
020
1{2 "cells": [3 {4 "cell_type": "markdown",5 "id": "db880701",6 "metadata": {},7 "source": [8 "# Day 3.... 18-06-2023"9 ]10 },11 {12 "cell_type": "markdown",13 "id": "dbc7ee60",14 "metadata": {},15 "source": [16 "## Agenda:\n",17 "- Recap\n",18 "- String slicing\n",19 "- String Functions\n",20 "- Activities\n",21 "- List\n",22 "- List Functions\n",23 "- Tuples\n",24 "- Tuple Functions\n",25 "- Activities\n",26 "- Dictionary\n",27 "- Dictionary Functions\n",28 "- Activities"29 ]30 },31 {32 "cell_type": "code",33 "execution_count": 28,34 "id": "481b72c0",35 "metadata": {},36 "outputs": [],37 "source": [38 "st2 = 'Python 3.9'"39 ]40 },41 {42 "cell_type": "code",43 "execution_count": 29,44 "id": "c99b5e53",45 "metadata": {},46 "outputs": [47 {48 "data": {49 "text/plain": [50 "'9.3 nohtyP'"51 ]52 },53 "execution_count": 29,54 "metadata": {},55 "output_type": "execute_result"56 }57 ],58 "source": [59 "### Reverse string\n",60 "st2[::-1]\n",61 "### st2[0:len(st2):-1] - Not this way"62 ]63 },64 {65 "cell_type": "code",66 "execution_count": 30,67 "id": "0ff6c113",68 "metadata": {},69 "outputs": [70 {71 "data": {72 "text/plain": [73 "'9.3 nohtyP'"74 ]75 },76 "execution_count": 30,77 "metadata": {},78 "output_type": "execute_result"79 }80 ],81 "source": [82 "st2[len(st2)-1:-len(st2)-1:-1]"83 ]84 },85 {86 "cell_type": "code",87 "execution_count": 32,88 "id": "d9f4c688",89 "metadata": {},90 "outputs": [91 {92 "data": {93 "text/plain": [94 "'9.3 nohtyP'"95 ]96 },97 "execution_count": 32,98 "metadata": {},99 "output_type": "execute_result"100 }101 ],102 "source": [103 "st2[10:-16:-1]"104 ]105 },106 {107 "cell_type": "code",108 "execution_count": 20,109 "id": "aeed5397",110 "metadata": {},111 "outputs": [112 {113 "data": {114 "text/plain": [115 "9"116 ]117 },118 "execution_count": 20,119 "metadata": {},120 "output_type": "execute_result"121 }122 ],123 "source": [124 "len(st2)-1"125 ]126 },127 {128 "cell_type": "code",129 "execution_count": 21,130 "id": "4ba29504",131 "metadata": {},132 "outputs": [133 {134 "data": {135 "text/plain": [136 "-11"137 ]138 },139 "execution_count": 21,140 "metadata": {},141 "output_type": "execute_result"142 }143 ],144 "source": [145 "-len(st2)-1"146 ]147 },148 {149 "cell_type": "code",150 "execution_count": 33,151 "id": "34f7824a",152 "metadata": {},153 "outputs": [],154 "source": [155 "st3 = 'Python 3.9 is simple to learn'"156 ]157 },158 {159 "cell_type": "code",160 "execution_count": 45,161 "id": "19be4a61",162 "metadata": {},163 "outputs": [164 {165 "data": {166 "text/plain": [167 "'nalo lmss . otP'"168 ]169 },170 "execution_count": 45,171 "metadata": {},172 "output_type": "execute_result"173 }174 ],175 "source": [176 "st3[::-2]"177 ]178 },179 {180 "cell_type": "code",181 "execution_count": 39,182 "id": "0674df17",183 "metadata": {},184 "outputs": [185 {186 "data": {187 "text/plain": [188 "29"189 ]190 },191 "execution_count": 39,192 "metadata": {},193 "output_type": "execute_result"194 }195 ],196 "source": [197 "len('Python 3.9 is simple to learn')"198 ]199 },200 {201 "cell_type": "code",202 "execution_count": 46,203 "id": "5b49691f",204 "metadata": {},205 "outputs": [],206 "source": [207 "### String Functions\n",208 "# int str bool dict list set print help len"209 ]210 },211 {212 "cell_type": "code",213 "execution_count": 1,214 "id": "a1922b89",215 "metadata": {},216 "outputs": [],217 "source": [218 "# help(str)"219 ]220 },221 {222 "cell_type": "code",223 "execution_count": 3,224 "id": "57f3081f",225 "metadata": {},226 "outputs": [227 {228 "data": {229 "text/plain": [230 "'Python is simple'"231 ]232 },233 "execution_count": 3,234 "metadata": {},235 "output_type": "execute_result"236 }237 ],238 "source": [239 "str.capitalize('python is simple')"240 ]241 },242 {243 "cell_type": "code",244 "execution_count": 20,245 "id": "fc1c723c",246 "metadata": {},247 "outputs": [248 {249 "data": {250 "text/plain": [251 "'Python is simple'"252 ]253 },254 "execution_count": 20,255 "metadata": {},256 "output_type": "execute_result"257 }258 ],259 "source": [260 "st5 = 'python is simple'\n",261 "st5.capitalize()"262 ]263 },264 {265 "cell_type": "code",266 "execution_count": 16,267 "id": "c6e087f1",268 "metadata": {},269 "outputs": [270 {271 "name": "stdout",272 "output_type": "stream",273 "text": [274 "Help on method_descriptor:\n",275 "\n",276 "capitalize(self, /)\n",277 " Return a capitalized version of the string.\n",278 " \n",279 " More specifically, make the first character have upper case and the rest lower\n",280 " case.\n",281 "\n"282 ]283 }284 ],285 "source": [286 "help(str.capitalize)"287 ]288 },289 {290 "cell_type": "code",291 "execution_count": 21,292 "id": "6afcc35a",293 "metadata": {},294 "outputs": [295 {296 "data": {297 "text/plain": [298 "'Python'"299 ]300 },301 "execution_count": 21,302 "metadata": {},303 "output_type": "execute_result"304 }305 ],306 "source": [307 "st6 = 'PYTHON'\n",308 "st6.capitalize()"309 ]310 },311 {312 "cell_type": "code",313 "execution_count": 22,314 "id": "1db67d52",315 "metadata": {},316 "outputs": [317 {318 "data": {319 "text/plain": [320 "'PYTHON'"321 ]322 },323 "execution_count": 22,324 "metadata": {},325 "output_type": "execute_result"326 }327 ],328 "source": [329 "st7 = 'python'\n",330 "st7.upper()"331 ]332 },333 {334 "cell_type": "code",335 "execution_count": 25,336 "id": "3727d5fa",337 "metadata": {},338 "outputs": [339 {340 "name": "stdout",341 "output_type": "stream",342 "text": [343 "PYTHON\n"344 ]345 }346 ],347 "source": [348 "st7 = st7.upper()\n",349 "print(st7)"350 ]351 },352 {353 "cell_type": "code",354 "execution_count": 41,355 "id": "aab75028",356 "metadata": {},357 "outputs": [358 {359 "name": "stdout",360 "output_type": "stream",361 "text": [362 "25\n",363 "4\n"364 ]365 }366 ],367 "source": [368 "st8 = 'Python is simple to learn'\n",369 "st9 = 'Python is simple to learn. Python is simple to code'\n",370 "print(len(st8))\n",371 "print(st9.count('i'))"372 ]373 },374 {375 "cell_type": "code",376 "execution_count": 44,377 "id": "cef22698",378 "metadata": {},379 "outputs": [380 {381 "name": "stdout",382 "output_type": "stream",383 "text": [384 "Hi Today is sunday We are learning Python \n"385 ]386 }387 ],388 "source": [389 "st1 = 'Hi '\n",390 "st2 = 'Today is sunday '\n",391 "st3 = 'We are learning Python '\n",392 "print(st1+st2+st3)"393 ]394 },395 {396 "cell_type": "code",397 "execution_count": 49,398 "id": "a55afbb8",399 "metadata": {},400 "outputs": [401 {402 "name": "stdout",403 "output_type": "stream",404 "text": [405 "Hi Hi Hi \n"406 ]407 }408 ],409 "source": [410 "st4 = st1*3\n",411 "print(st4)"412 ]413 },414 {415 "cell_type": "code",416 "execution_count": 74,417 "id": "20ef0dc1",418 "metadata": {},419 "outputs": [420 {421 "name": "stdout",422 "output_type": "stream",423 "text": [424 "7\n",425 "11\n"426 ]427 }428 ],429 "source": [430 "st8 = 'Python is simple to learn'\n",431 "print(st8.find('i'))\n",432 "print(st8.rfind('i'))"433 ]434 },435 {436 "cell_type": "code",437 "execution_count": 73,438 "id": "943a2e32",439 "metadata": {},440 "outputs": [],441 "source": [442 "# help(str.rfind)"443 ]444 },445 {446 "cell_type": "code",447 "execution_count": 76,448 "id": "c728cdf1",449 "metadata": {},450 "outputs": [451 {452 "name": "stdout",453 "output_type": "stream",454 "text": [455 "1\n"456 ]457 }458 ],459 "source": [460 "st8 = 'Python is simple to learn'\n",461 "print(st8.count('i',8))"462 ]463 },464 {465 "cell_type": "code",466 "execution_count": 78,467 "id": "9495c2cb",468 "metadata": {},469 "outputs": [470 {471 "name": "stdout",472 "output_type": "stream",473 "text": [474 "0\n"475 ]476 }477 ],478 "source": [479 "st8 = 'Python is simple to learn'\n",480 "print(st8.count('I',8))"481 ]482 },483 {484 "cell_type": "markdown",485 "id": "18156de8",486 "metadata": {},487 "source": [488 "### Difference between find and index"489 ]490 },491 {492 "cell_type": "code",493 "execution_count": 88,494 "id": "83f7ce63",495 "metadata": {},496 "outputs": [497 {498 "name": "stdout",499 "output_type": "stream",500 "text": [501 "2\n",502 "2\n"503 ]504 }505 ],506 "source": [507 "st9 = 'Python'\n",508 "print(st9.index('th'))\n",509 "print(st9.find('th'))"510 ]511 },512 {513 "cell_type": "code",514 "execution_count": 90,515 "id": "728e9a33",516 "metadata": {},517 "outputs": [518 {519 "name": "stdout",520 "output_type": "stream",521 "text": [522 "-1\n"523 ]524 }525 ],526 "source": [527 "st9 = 'Python'\n",528 "print(st9.find('ij'))"529 ]530 },531 {532 "cell_type": "code",533 "execution_count": 92,534 "id": "24370bc0",535 "metadata": {},536 "outputs": [537 {538 "name": "stdout",539 "output_type": "stream",540 "text": [541 "Help on method_descriptor:\n",542 "\n",543 "find(...)\n",544 " S.find(sub[, start[, end]]) -> int\n",545 " \n",546 " Return the lowest index in S where substring sub is found,\n",547 " such that sub is contained within S[start:end]. Optional\n",548 " arguments start and end are interpreted as in slice notation.\n",549 " \n",550 " Return -1 on failure.\n",551 "\n"552 ]553 }554 ],555 "source": [556 "help(str.find)"557 ]558 },559 {560 "cell_type": "code",561 "execution_count": 89,562 "id": "ff0db158",563 "metadata": {},564 "outputs": [565 {566 "ename": "ValueError",567 "evalue": "substring not found",568 "output_type": "error",569 "traceback": [570 "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",571 "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",572 "Input \u001b[1;32mIn [89]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mst9\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mindex\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mij\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m)\n",573 "\u001b[1;31mValueError\u001b[0m: substring not found"574 ]575 }576 ],577 "source": [578 "print(st9.index('ij'))"579 ]580 },581 {582 "cell_type": "code",583 "execution_count": 96,584 "id": "1e1fed72",585 "metadata": {},586 "outputs": [],587 "source": [588 "st10 = 'Today is Sunday and we are learning Python'\n",589 "res = st10.split('a')"590 ]591 },592 {593 "cell_type": "code",594 "execution_count": 97,595 "id": "18b8d95c",596 "metadata": {},597 "outputs": [598 {599 "name": "stdout",600 "output_type": "stream",601 "text": [602 "['Tod', 'y is Sund', 'y ', 'nd we ', 're le', 'rning Python']\n"603 ]604 }605 ],606 "source": [607 "print(res)"608 ]609 },610 {611 "cell_type": "code",612 "execution_count": 98,613 "id": "9aaad557",614 "metadata": {},615 "outputs": [616 {617 "data": {618 "text/plain": [619 "'Tod'"620 ]621 },622 "execution_count": 98,623 "metadata": {},624 "output_type": "execute_result"625 }626 ],627 "source": [628 "res[0]"629 ]630 },631 {632 "cell_type": "code",633 "execution_count": 99,634 "id": "35ca1613",635 "metadata": {},636 "outputs": [637 {638 "data": {639 "text/plain": [640 "'re le'"641 ]642 },643 "execution_count": 99,644 "metadata": {},645 "output_type": "execute_result"646 }647 ],648 "source": [649 "res[4]"650 ]651 },652 {653 "cell_type": "code",654 "execution_count": 108,655 "id": "eabaae9f",656 "metadata": {},657 "outputs": [658 {659 "data": {660 "text/plain": [661 "'TODAY IS SUNDAY AND WE ARE LEARNING PYTHON'"662 ]663 },664 "execution_count": 108,665 "metadata": {},666 "output_type": "execute_result"667 }668 ],669 "source": [670 "st10.upper()"671 ]672 },673 {674 "cell_type": "code",675 "execution_count": 109,676 "id": "f47529f6",677 "metadata": {},678 "outputs": [679 {680 "data": {681 "text/plain": [682 "'today is sunday and we are learning python'"683 ]684 },685 "execution_count": 109,686 "metadata": {},687 "output_type": "execute_result"688 }689 ],690 "source": [691 "st10.lower()"692 ]693 },694 {695 "cell_type": "code",696 "execution_count": 113,697 "id": "6ac2cdd1",698 "metadata": {},699 "outputs": [700 {701 "data": {702 "text/plain": [703 "True"704 ]705 },706 "execution_count": 113,707 "metadata": {},708 "output_type": "execute_result"709 }710 ],711 "source": [712 "shdgfh = 'D:\\Desktop_2\\Casestudy\\FoodDeliveryStartup\\CaseStudy - FoodDeliveryStartup.pdf' \n",713 "shdgfh.endswith('.pdf')"714 ]715 },716 {717 "cell_type": "code",718 "execution_count": 112,719 "id": "ef8feae4",720 "metadata": {},721 "outputs": [722 {723 "data": {724 "text/plain": [725 "False"726 ]727 },728 "execution_count": 112,729 "metadata": {},730 "output_type": "execute_result"731 }732 ],733 "source": [734 "shdgfh = 'Today is monday' \n",735 "shdgfh.endswith('a')"736 ]737 },738 {739 "cell_type": "code",740 "execution_count": 114,741 "id": "db036940",742 "metadata": {},743 "outputs": [744 {745 "data": {746 "text/plain": [747 "True"748 ]749 },750 "execution_count": 114,751 "metadata": {},752 "output_type": "execute_result"753 }754 ],755 "source": [756 "shdgfh = 'Today is monday' \n",757 "shdgfh.endswith('y')"758 ]759 },760 {761 "cell_type": "code",762 "execution_count": 115,763 "id": "f75c3503",764 "metadata": {},765 "outputs": [766 {767 "data": {768 "text/plain": [769 "True"770 ]771 },772 "execution_count": 115,773 "metadata": {},774 "output_type": "execute_result"775 }776 ],777 "source": [778 "shdgfh = 'Today is monday' \n",779 "shdgfh.endswith('day')"780 ]781 },782 {783 "cell_type": "code",784 "execution_count": 121,785 "id": "f8da0f73",786 "metadata": {},787 "outputs": [788 {789 "name": "stdout",790 "output_type": "stream",791 "text": [792 " Hello how are you \n",793 "25\n",794 "Hello how are you\n",795 "23\n"796 ]797 }798 ],799 "source": [800 "st12 = ' Hello how are you '\n",801 "st13 = st12.strip()\n",802 "print(st12)\n",803 "print(len(st12))\n",804 "print(st13)\n",805 "print(len(st13))"806 ]807 },808 {809 "cell_type": "code",810 "execution_count": 134,811 "id": "310b9317",812 "metadata": {},813 "outputs": [],814 "source": [815 "st14 = 'Python'\n",816 "st15 = st14.replace('y','4545456')"817 ]818 },819 {820 "cell_type": "code",821 "execution_count": 136,822 "id": "e0a09346",823 "metadata": {},824 "outputs": [825 {826 "name": "stdout",827 "output_type": "stream",828 "text": [829 "Python\n",830 "P4545456thon\n"831 ]832 }833 ],834 "source": [835 "print(st14)\n",836 "print(st15)"837 ]838 },839 {840 "cell_type": "code",841 "execution_count": 187,842 "id": "cf9b339c",843 "metadata": {},844 "outputs": [845 {846 "data": {847 "text/plain": [848 "' Hello how are you '"849 ]850 },851 "execution_count": 187,852 "metadata": {},853 "output_type": "execute_result"854 }855 ],856 "source": [857 "st12 = ' Hello how are you '\n",858 "st12.replace(' ',' ').replace(' ',' ').replace(' ',' ').replace(' ',' ').replace(' ',' ').replace(' ',' ')"859 ]860 },861 {862 "cell_type": "code",863 "execution_count": 166,864 "id": "a77280ac",865 "metadata": {},866 "outputs": [867 {868 "name": "stdout",869 "output_type": "stream",870 "text": [871 "zzzppp\n",872 "<class 'str'>\n",873 "---ppp\n"874 ]875 },876 {877 "data": {878 "text/plain": [879 "3"880 ]881 },882 "execution_count": 166,883 "metadata": {},884 "output_type": "execute_result"885 }886 ],887 "source": [888 "st12 = 'zzzppp'\n",889 "print(st12)\n",890 "st16 = st12.replace('z','-')\n",891 "print(type(st16))\n",892 "print(st16)\n",893 "st16.count('-')"894 ]895 },896 {897 "cell_type": "code",898 "execution_count": 171,899 "id": "1460726e",900 "metadata": {},901 "outputs": [902 {903 "name": "stdout",904 "output_type": "stream",905 "text": [906 "<class 'int'>\n"907 ]908 }909 ],910 "source": [911 "st12 = 'zzzppp'\n",912 "count_iphen= st12.replace('z','-').count('-')\n",913 "print(type(count_iphen))"914 ]915 },916 {917 "cell_type": "code",918 "execution_count": 172,919 "id": "b118b3a2",920 "metadata": {},921 "outputs": [922 {923 "name": "stdout",924 "output_type": "stream",925 "text": [926 "Help on method_descriptor:\n",927 "\n",928 "count(...)\n",929 " S.count(sub[, start[, end]]) -> int\n",930 " \n",931 " Return the number of non-overlapping occurrences of substring sub in\n",932 " string S[start:end]. Optional arguments start and end are\n",933 " interpreted as in slice notation.\n",934 "\n"935 ]936 }937 ],938 "source": [939 "help(str.count)"940 ]941 },942 {943 "cell_type": "code",944 "execution_count": 175,945 "id": "ffc009a8",946 "metadata": {},947 "outputs": [948 {949 "name": "stdout",950 "output_type": "stream",951 "text": [952 "<class 'str'>\n"953 ]954 }955 ],956 "source": [957 "print(type(st12.replace('z','-')))"958 ]959 },960 {961 "cell_type": "code",962 "execution_count": 181,963 "id": "f873eb1b",964 "metadata": {},965 "outputs": [966 {967 "data": {968 "text/plain": [969 "3"970 ]971 },972 "execution_count": 181,973 "metadata": {},974 "output_type": "execute_result"975 }976 ],977 "source": [978 "count_iphen"979 ]980 },981 {982 "cell_type": "code",983 "execution_count": 170,984 "id": "67b86a8a",985 "metadata": {},986 "outputs": [987 {988 "ename": "AttributeError",989 "evalue": "'int' object has no attribute 'find'",990 "output_type": "error",991 "traceback": [992 "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",993 "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)",994 "Input \u001b[1;32mIn [170]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mcount_iphen\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfind\u001b[49m(\u001b[38;5;241m3\u001b[39m)\n",995 "\u001b[1;31mAttributeError\u001b[0m: 'int' object has no attribute 'find'"996 ]997 }998 ],999 "source": [1000 "### int object doesnot have find function\n",1001 "count_iphen.find(3)"1002 ]1003 },1004 {1005 "cell_type": "code",1006 "execution_count": 188,1007 "id": "c64ce6d2",1008 "metadata": {},1009 "outputs": [1010 {1011 "data": {1012 "text/plain": [1013 "-1"1014 ]1015 },1016 "execution_count": 188,1017 "metadata": {},1018 "output_type": "execute_result"1019 }1020 ],1021 "source": [1022 "'Python'.find('e')"1023 ]1024 },1025 {1026 "cell_type": "code",1027 "execution_count": 182,1028 "id": "11185d00",1029 "metadata": {},1030 "outputs": [1031 {1032 "data": {1033 "text/plain": [1034 "'---ppp'"1035 ]1036 },1037 "execution_count": 182,1038 "metadata": {},1039 "output_type": "execute_result"1040 }1041 ],1042 "source": [1043 "st12.replace('z','-')"1044 ]1045 },1046 {1047 "cell_type": "code",1048 "execution_count": 183,1049 "id": "97c98cd8",1050 "metadata": {},1051 "outputs": [1052 {1053 "data": {1054 "text/plain": [1055 "3"1056 ]1057 },1058 "execution_count": 183,1059 "metadata": {},1060 "output_type": "execute_result"1061 }1062 ],1063 "source": [1064 "'---ppp'.count('p')"1065 ]1066 },1067 {1068 "cell_type": "code",1069 "execution_count": 189,1070 "id": "2f85b92c",1071 "metadata": {},1072 "outputs": [],1073 "source": [1074 "st15 = 'Python is simple'"1075 ]1076 },1077 {1078 "cell_type": "code",1079 "execution_count": 245,1080 "id": "9f89e841",1081 "metadata": {},1082 "outputs": [1083 {1084 "name": "stdout",1085 "output_type": "stream",1086 "text": [1087 "hi\n",1088 "hello\n"1089 ]1090 }1091 ],1092 "source": [1093 "print('hi\\nhello')"1094 ]1095 },1096 {1097 "cell_type": "code",1098 "execution_count": 260,1099 "id": "84b3f436",1100 "metadata": {},1101 "outputs": [],1102 "source": [1103 "path = r\"D:\\t1\\newCasestydy\\FoodDeliveryStartup.pdf\""1104 ]1105 },1106 {1107 "cell_type": "code",1108 "execution_count": 244,1109 "id": "c94e420e",1110 "metadata": {},1111 "outputs": [1112 {1113 "name": "stdout",1114 "output_type": "stream",1115 "text": [1116 "D:\\\\t1\\\\newCasestydy\\\\FoodDeliveryStartup.pdf\n"1117 ]1118 }1119 ],1120 "source": [1121 "print(path)"1122 ]1123 },1124 {1125 "cell_type": "code",1126 "execution_count": 257,1127 "id": "968ca804",1128 "metadata": {},1129 "outputs": [],1130 "source": [1131 "st= \"Work is 'worship'\""1132 ]1133 },1134 {1135 "cell_type": "code",1136 "execution_count": 258,1137 "id": "0eb2944a",1138 "metadata": {},1139 "outputs": [1140 {1141 "name": "stdout",1142 "output_type": "stream",1143 "text": [1144 "Work is 'worship'\n"1145 ]1146 }1147 ],1148 "source": [1149 "print(st)"1150 ]1151 },1152 {1153 "cell_type": "code",1154 "execution_count": 263,1155 "id": "b59fb80f",1156 "metadata": {},1157 "outputs": [],1158 "source": [1159 "res= path.rpartition('\\\\')"1160 ]1161 },1162 {1163 "cell_type": "code",1164 "execution_count": 264,1165 "id": "be2a3968",1166 "metadata": {},1167 "outputs": [1168 {1169 "data": {1170 "text/plain": [1171 "'D:\\\\t1\\\\newCasestydy'"1172 ]1173 },1174 "execution_count": 264,1175 "metadata": {},1176 "output_type": "execute_result"1177 }1178 ],1179 "source": [1180 "res[0]"1181 ]1182 },1183 {1184 "cell_type": "code",1185 "execution_count": 265,1186 "id": "bca91386",1187 "metadata": {},1188 "outputs": [1189 {1190 "data": {1191 "text/plain": [1192 "'\\\\'"1193 ]1194 },1195 "execution_count": 265,1196 "metadata": {},1197 "output_type": "execute_result"1198 }1199 ],1200 "source": [