python/CAM/reg expression
Материал из Xgu.ru
Автор: Владимир Кореньков
Содержание |
Исходный файл code.nc
% O1005 N1 G94 G90 T1 M6 N2 G0 G56 X0 Y0 N3 G43 H01 Z100 N4 S1500 M3 N5 G01 Z55 F5000 M8 N4 X208.96 Y-99.963 N5 G1 G94 Z14.052 F300. N6 Y-100.396 Z13.63 N7 Y-100.853 Z13.235 N8 Y-101.333 Z12.869 N9 Y-101.835 Z12.532 N10 Y-102.355 Z12.226 N11 Y-102.894 Z11.952 N12 Y-103.448 Z11.712 N13 Y-104.015 Z11.505 N14 Y-104.594 Z11.332 N15 Y-105.183 Z11.195 N16 Y-105.778 Z11.094 N17 Y-106.379 Z11.029 N18 Y-106.982 Z11. N19 Y-150.078 F96. N20 X208.935 Y-150.675 N21 X208.869 Y-151.272 N22 X208.763 Y-151.87 N23 X208.625 Y-152.428 N24 X208.42 Y-153.064 N25 X208.178 Y-153.661 N26 X207.884 Y-154.258 N27 X207.53 Y-154.855 N28 X207.11 Y-155.453 N29 X206.609 Y-156.05 N30 X206.237 Y-156.433 N31 X205.639 Y-156.963 N32 X205.042 Y-157.407 N33 X204.445 Y-157.78 N34 X203.848 Y-158.092 N35 X203.25 Y-158.35 N36 X202.653 Y-158.558 N37 X202.056 Y-158.721 N38 X201.459 Y-158.841 N39 X200.862 Y-158.919 N40 X200.265 Y-158.956 N41 X-.078 Y-158.96 N42 X-.675 Y-158.935 N43 X-1.272 Y-158.869 N44 X-1.87 Y-158.763 N45 X-2.467 Y-158.614 N46 X-3.012 Y-158.439 N47 X-3.661 Y-158.178 N48 X-4.258 Y-157.884 N49 X-4.856 Y-157.53 N50 X-5.273 Y-157.244 N51 X-6.008 Y-156.647 N52 X-6.609 Y-156.05 N53 X-7.11 Y-155.453 N54 X-7.531 Y-154.855 N55 X-7.841 Y-154.336 N56 X-8.178 Y-153.661 N57 X-8.439 Y-153.012 N58 X-8.614 Y-152.467 N59 X-8.763 Y-151.87 N60 X-8.869 Y-151.272 N61 X-8.935 Y-150.675 N62 X-8.96 Y-150.078 N63 Y-.121 N64 X-8.947 Y.478 N65 X-8.895 Y1.075 N66 X-8.803 Y1.672 N67 X-8.668 Y2.269 N68 X-8.489 Y2.866 N69 X-8.264 Y3.463 N70 X-7.987 Y4.06 N71 X-7.654 Y4.658 N72 X-7.257 Y5.255 N73 X-6.785 Y5.852 N74 X-6.22 Y6.449 N75 X-5.535 Y7.046 N76 X-4.855 Y7.531 N77 X-4.258 Y7.884 N78 X-3.661 Y8.178 N79 X-3.064 Y8.42 N80 X-2.467 Y8.614 N81 X-1.869 Y8.763 N82 X-1.476 Y8.838 N83 X-.675 Y8.935 N84 X-.078 Y8.96 N85 X200.265 Y8.956 N86 X200.862 Y8.919 N87 X201.459 Y8.841 N88 X202.056 Y8.721 N89 X202.653 Y8.558 N90 X203.25 Y8.35 N91 X203.848 Y8.092 N92 X204.445 Y7.78 N93 X205.042 Y7.407 N94 X205.534 Y7.047 N95 X206.22 Y6.449 N96 X206.785 Y5.852 N97 X207.257 Y5.255 N98 X207.654 Y4.658 N99 X207.987 Y4.06 N100 X208.264 Y3.463 N101 X208.489 Y2.866 N102 X208.625 Y2.428 N103 X208.803 Y1.672 N104 X208.895 Y1.075 N105 X208.947 Y.478 N106 X208.96 Y-.121 N107 Y-106.982 N108 X201.36 N109 Y-149.918 N110 X201.352 Y-150.102 N111 X201.325 Y-150.29 N112 X201.272 Y-150.468 N113 X201.195 Y-150.639 N114 X201.081 Y-150.815 N115 X200.973 Y-150.943 N116 X200.755 Y-151.124 N117 X200.577 Y-151.226 N118 X200.399 Y-151.296 N119 X200.219 Y-151.338 N120 X200.025 Y-151.356 N121 X.082 Y-151.36 N122 X-.191 Y-151.342 N123 X-.382 Y-151.301 N124 X-.56 Y-151.233 N125 X-.741 Y-151.134 N126 X-1.007 Y-150.902 N127 X-1.153 Y-150.712 N128 X-1.285 Y-150.43 N129 X-1.342 Y-150.191 N130 X-1.36 Y-149.918 N131 Y-.202 N132 X-1.346 Y.162 N133 X-1.312 Y.341 N134 X-1.251 Y.52 N135 X-1.161 Y.698 N136 X-1.033 Y.874 N137 X-.822 Y1.072 N138 X-.639 Y1.195 N139 X-.46 Y1.275 N140 X-.276 Y1.327 N141 X.082 Y1.36 N142 X200.025 Y1.356 N143 X200.219 Y1.338 N144 X200.399 Y1.296 N145 X200.577 Y1.226 N146 X200.779 Y1.109 N147 X201.033 Y.873 N148 X201.21 Y.609 N149 X201.291 Y.416 N150 X201.346 Y.162 N151 X201.36 Y-.202 N152 Y-106.982 N153 X193.76 N154 Y-143.742 N155 X194.531 Y-144.528 N156 X193.746 Y-143.756 N157 X6.254 Y-143.76 N158 X5.469 Y-144.531 N159 X6.24 Y-143.746 N160 Y-6.254 N161 X5.468 Y-5.469 N162 X6.254 Y-6.24 N163 X193.746 Y-6.244 N164 X194.532 Y-5.472 N165 X193.76 Y-6.258 N166 Y-106.982 N167 X186.16 N168 Y-136.142 N169 X186.931 Y-136.928 N170 X186.146 Y-136.156 N171 X13.854 Y-136.16 N172 X13.069 Y-136.931 N173 X13.84 Y-136.145 N174 Y-125.877 N175 X19.743 N176 X21.454 Y-127.221 N177 X21.447 Y-127.23 N178 X21.725 Y-127.517 N179 X22.818 Y-128.553 N180 X22.827 Y-128.545 N181 X24.491 Y-130.579 N182 X22.813 Y-128.559 N183 X21.454 N184 X20.669 Y-129.331 N185 X21.44 Y-128.545 N186 Y-127.235 N187 X19.743 Y-125.877 N188 X13.84 N189 Y-13.855 N190 X13.068 Y-13.069 N191 X13.854 Y-13.84 N192 X23.379 Y-13.841 N193 Y-19.79 N194 X22.082 Y-21.455 N195 X22.073 Y-21.448 N196 X21.447 Y-22.079 N197 X21.454 Y-22.088 N198 X19.757 Y-23.423 N199 X21.44 Y-22.073 N200 Y-21.455 N201 X20.668 Y-20.669 N202 X21.454 Y-21.441 N203 X22.067 N204 X23.379 Y-19.79 N205 Y-13.841 N206 X186.146 Y-13.844 N207 X186.932 Y-13.072 N208 X186.16 Y-13.858 N209 Y-106.982 N210 X178.56 N211 Y-128.542 N212 X179.331 Y-129.328 N213 X178.546 Y-128.557 N214 X107.456 Y-128.558 N215 Y-122.455 N216 X109.629 Y-120.944 N217 X109.857 Y-120.288 N218 X110.213 Y-119.11 N219 X110.63 Y-117.439 N220 X110.867 Y-116.279 N221 X111.021 Y-115.306 N222 X109.835 Y-114.19 N223 X111.037 Y-115.294 N224 X111.029 Y-115.302 N225 X111.282 Y-115.604 N226 X112.878 Y-117.35 N227 X114.536 Y-118.948 N228 X116.098 Y-120.287 N229 X116.96 Y-120.951 N230 X116.969 Y-120.944 N231 X118.954 Y-123.252 N232 X116.955 Y-120.958 N233 X109.638 N234 X107.456 Y-122.455 N235 Y-128.558 N236 X95.732 N237 X94.054 Y-130.576 N238 X95.718 Y-128.544 N239 X95.726 Y-128.551 N240 X96.336 Y-127.991 N241 X97.056 Y-127.274 N242 X97.776 Y-126.492 N243 X98.491 Y-125.643 N244 X99.163 Y-124.762 N245 X100.098 Y-123.381 N246 X100.557 Y-122.614 N247 X101.307 Y-121.221 N248 X101.674 Y-120.436 N249 X102.259 Y-119.007 N250 X102.737 Y-117.606 N251 X102.953 Y-116.844 N252 X103.288 Y-115.45 N253 X103.432 Y-114.677 N254 X103.637 Y-113.233 N255 X103.753 Y-111.784 N256 X103.784 Y-110.49 N257 Y-39.055 N258 X103.761 Y-37.675 N259 X103.714 Y-36.913 N260 X103.571 Y-35.517 N261 X103.462 Y-34.811 N262 X103.181 Y-33.362 N263 X102.995 Y-32.608 N264 X102.785 Y-31.876 N265 X102.33 Y-30.477 N266 X102.027 Y-29.692 N267 X101.424 Y-28.325 N268 X101.061 Y-27.596 N269 X100.63 Y-26.809 N270 X99.84 Y-25.521 N271 X99.261 Y-24.677 N272 X98.378 Y-23.518 N273 X97.657 Y-22.674 N274 X96.877 Y-21.845 N275 X96.46 Y-21.449 N276 X96.451 Y-21.456 N277 X95.169 Y-19.81 N278 X96.465 Y-21.442 N279 X107.819 N280 Y-27.59 N281 X109.871 Y-29.04 N282 X116.127 Y-29.042 N283 X117.833 Y-27.026 N284 X116.142 Y-29.056 N285 X116.132 Y-29.049 N286 X115.428 Y-29.621 N287 X114.83 Y-30.147 N288 X113.391 Y-31.487 N289 X112.064 Y-32.863 N290 X111.042 Y-34.039 N291 X111.05 Y-34.047 N292 X109.839 Y-35.157 N293 X111.034 Y-34.034 N294 X110.928 Y-33.387 N295 X110.687 Y-32.128 N296 X110.423 Y-30.975 N297 X110.021 Y-29.553 N298 X109.861 Y-29.054 N299 X107.819 Y-27.59 N300 Y-21.442 N301 X178.546 Y-21.443 N302 X179.332 Y-20.672 N303 X178.56 Y-21.458 N304 Y-106.982 N305 X174.956 N306 X170.96 Y-110.833 N307 Y-120.943 N308 X171.731 Y-121.728 N309 X170.946 Y-120.957 N310 X161.808 N311 X159.815 Y-123.248 N312 X161.794 Y-120.943 N313 X161.803 Y-120.951 N314 X162.687 Y-120.265 N315 X164.055 Y-119.099 N316 X165.785 Y-117.45 N317 X166.984 Y-116.169 N318 X167.398 Y-115.696 N319 X168.717 Y-114.081 N320 X169.658 Y-112.796 N321 X170.07 Y-112.2 N322 X170.954 Y-110.828 N323 X170.946 Y-110.819 N324 X174.956 Y-106.982 N325 X169.612 Y-104.755 N326 X169.465 Y-105.109 N327 X168.509 Y-107.049 N328 X167.56 Y-108.712 N329 X166.708 Y-110.032 N330 X166.374 Y-110.513 N331 X165.491 Y-111.715 N332 X164.306 Y-113.159 N333 X163.99 Y-113.516 N334 X162.864 Y-114.717 N335 X161.303 Y-116.197 N336 X160.101 Y-117.213 N337 X159.446 Y-117.719 N338 X158.3 Y-118.568 N339 X156.857 Y-119.522 N340 X155.297 Y-120.435 N341 X154.697 Y-120.753 N342 X153.495 Y-121.357 N343 X151.693 Y-122.144 N344 X149.891 Y-122.808 N345 X148.09 Y-123.356 N346 X146.289 Y-123.792 N347 X145.688 Y-123.917 N348 X143.886 Y-124.218 N349 X142.084 Y-124.417 N350 X140.282 Y-124.515 N351 X138.482 Y-124.513 N352 X137.88 Y-124.49 N353 X136.079 Y-124.361 N354 X134.277 Y-124.131 N355 X132.475 Y-123.797 N356 X130.674 Y-123.358 N357 X128.872 Y-122.809 N358 X127.071 Y-122.144 N359 X126.47 Y-121.894 N360 X125.191 Y-121.322 N361 X123.467 Y-120.438 N362 X121.665 Y-119.372 N363 X119.864 Y-118.139 N364 X118.54 Y-117.118 N365 X117.146 Y-115.917 N366 X115.66 Y-114.476 N367 X114.242 Y-112.914 N368 X113.258 Y-111.698 N369 X112.821 Y-111.113 N370 X111.967 Y-109.911 N371 X110.842 Y-108.109 N372 X110.182 Y-106.909 N373 X109.869 Y-106.308 N374 X109.3 Y-105.108 N375 X109.034 Y-104.507 N376 X108.453 Y-103.065 N377 X107.853 Y-101.307 N378 X107.731 Y-100.903 N379 X107.25 Y-99.101 N380 X106.877 Y-97.299 N381 X106.608 Y-95.497 N382 X106.44 Y-93.696 N383 X106.373 Y-91.895 N384 X106.367 Y-57.704 N385 X99.784 N386 Y-110.49 N387 X99.754 Y-111.693 N388 X99.651 Y-112.895 N389 X99.473 Y-114.104 N390 X99.359 Y-114.697 N391 X99.067 Y-115.898 N392 X98.893 Y-116.501 N393 X98.478 Y-117.703 N394 X97.979 Y-118.904 N395 X97.693 Y-119.506 N396 X97.042 Y-120.707 N397 X96.676 Y-121.309 N398 X95.857 Y-122.511 N399 X95.326 Y-123.198 N400 X94.724 Y-123.906 N401 X94.123 Y-124.554 N402 X93.522 Y-125.148 N403 X92.921 Y-125.696 N404 X92.32 Y-126.201 N405 X91.651 Y-126.718 N406 X90.79 Y-127.319 N407 X89.82 Y-127.92 N408 X88.714 Y-128.521 N409 X88.113 Y-128.81 N410 X87.397 Y-129.122 N411 X86.309 Y-129.537 N412 X85.107 Y-129.91 N413 X83.905 Y-130.208 N414 X82.703 Y-130.424 N415 X81.501 Y-130.569 N416 X80.9 Y-130.608 N417 X79.699 Y-130.648 N418 X38.91 N419 X37.708 Y-130.618 N420 X36.505 Y-130.515 N421 X35.234 Y-130.323 N422 X34.101 Y-130.085 N423 X32.9 Y-129.754 N424 X32.299 Y-129.559 N425 X31.697 Y-129.34 N426 X30.496 Y-128.839 N427 X29.826 Y-128.52 N428 X28.692 Y-127.902 N429 X27.749 Y-127.318 N430 X26.889 Y-126.716 N431 X26.12 Y-126.116 N432 X25.419 Y-125.514 N433 X24.485 Y-124.623 N434 X23.884 Y-123.981 N435 X23.148 Y-123.11 N436 X22.683 Y-122.506 N437 X22.258 Y-121.909 N438 X21.864 Y-121.308 N439 X21.481 Y-120.675 N440 X21.163 Y-120.106 N441 X20.563 Y-118.903 N442 X20.279 Y-118.248 N443 X19.847 Y-117.101 N444 X19.649 Y-116.498 N445 X19.322 Y-115.298 N446 X19.184 Y-114.697 N447 X19.068 Y-114.095 N448 X18.976 Y-113.494 N449 X18.831 Y-112.291 N450 X18.767 Y-111.089 N451 X18.761 Y-38.509 N452 X18.809 Y-37.306 N453 X18.93 Y-36.104 N454 X19.077 Y-35.193 N455 X19.252 Y-34.302 N456 X19.395 Y-33.701 N457 X19.561 Y-33.099 N458 X19.953 Y-31.897 N459 X20.279 Y-31.057 N460 X20.707 Y-30.095 N461 X21.005 Y-29.494 N462 X21.327 Y-28.893 N463 X21.679 Y-28.29 N464 X22.472 Y-27.089 N465 X22.917 Y-26.488 N466 X23.397 Y-25.887 N467 X23.918 Y-25.286 N468 X24.487 Y-24.685 N469 X25.095 Y-24.084 N470 X25.766 Y-23.483 N471 X26.29 Y-23.047 N472 X27.492 Y-22.157 N473 X28.223 Y-21.68 N474 X29.294 Y-21.061 N475 X29.895 Y-20.748 N476 X30.496 Y-20.461 N477 X31.098 Y-20.199 N478 X32.299 Y-19.743 N479 X32.902 Y-19.545 N480 X34.102 Y-19.218 N481 X34.704 Y-19.08 N482 X35.305 Y-18.964 N483 X35.906 Y-18.871 N484 X37.109 Y-18.726 N485 X38.311 Y-18.662 N486 X79.7 Y-18.653 N487 X80.903 Y-18.688 N488 X82.105 Y-18.795 N489 X83.305 Y-18.981 N490 X83.906 Y-19.094 N491 X84.685 Y-19.276 N492 X85.709 Y-19.568 N493 X86.311 Y-19.765 N494 X86.912 Y-19.986 N495 X87.513 Y-20.231 N496 X88.715 Y-20.781 N497 X89.316 Y-21.095 N498 X89.917 Y-21.438 N499 X90.518 Y-21.807 N500 X91.227 Y-22.281 N501 X91.721 Y-22.636 N502 X92.923 Y-23.607 N503 X94.125 Y-24.748 N504 X94.725 Y-25.395 N505 X95.327 Y-26.105 N506 X96.071 Y-27.09 N507 X96.528 Y-27.765 N508 X97.216 Y-28.893 N509 X97.54 Y-29.494 N510 X97.837 Y-30.095 N511 X98.363 Y-31.296 N512 X98.591 Y-31.899 N513 X98.977 Y-33.099 N514 X99.148 Y-33.701 N515 X99.293 Y-34.302 N516 X99.533 Y-35.561 N517 X99.614 Y-36.105 N518 X99.733 Y-37.307 N519 X99.768 Y-37.908 N520 X99.784 Y-39.109 N521 Y-57.704 N522 X106.367 N523 X106.394 Y-56.503 N524 X106.516 Y-54.7 N525 X106.738 Y-52.898 N526 X107.064 Y-51.097 N527 X107.494 Y-49.297 N528 X107.66 Y-48.695 N529 X108.235 Y-46.893 N530 X108.928 Y-45.091 N531 X109.747 Y-43.29 N532 X110.369 Y-42.09 N533 X110.703 Y-41.489 N534 X111.457 Y-40.225 N535 X112.659 Y-38.45 N536 X113.86 Y-36.894 N537 X115.087 Y-35.482 N538 X116.262 Y-34.273 N539 X117.548 Y-33.081 N540 X118.063 Y-32.631 N541 X119.264 Y-31.662 N542 X119.865 Y-31.218 N543 X121.067 Y-30.369 N544 X122.483 Y-29.477 N545 X124.068 Y-28.594 N546 X124.691 Y-28.276 N547 X125.96 Y-27.676 N548 X127.672 Y-26.973 N549 X128.273 Y-26.753 N550 X129.473 Y-26.349 N551 X130.074 Y-26.166 N552 X131.877 Y-25.69 N553 X133.679 Y-25.32 N554 X135.48 Y-25.055 N555 X137.282 Y-24.891 N556 X139.082 Y-24.828 N557 X140.284 Y-24.839 N558 X141.485 Y-24.896 N559 X143.286 Y-25.07 N560 X143.888 Y-25.15 N561 X145.69 Y-25.463 N562 X147.492 Y-25.886 N563 X150.49 Y-26.77 N564 X151.688 Y-27.055 N565 X152.886 Y-27.274 N566 X153.484 Y-27.362 N567 X154.682 Y-27.488 N568 X155.879 Y-27.551 N569 X157.077 N570 X158.274 Y-27.487 N571 X159.472 Y-27.361 N572 X160.67 Y-27.171 N573 X163.071 Y-26.668 N574 X163.671 Y-26.585 N575 X164.274 Y-26.526 N576 X164.875 Y-26.501 N577 X165.478 Y-26.497 N578 X166.078 Y-26.528 N579 X166.681 Y-26.582 N580 X167.282 Y-26.668 N581 X167.884 Y-26.781 N582 X168.485 Y-26.926 N583 X169.087 Y-27.101 N584 X169.69 Y-27.31 N585 X170.572 Y-27.676 N586 X170.892 Y-27.83 N587 X171.721 Y-28.278 N588 X172.095 Y-28.509 N589 X172.698 Y-28.917 N590 X173.423 Y-29.482 N591 X174.1 Y-30.084 N592 X174.687 Y-30.686 N593 X175.2 Y-31.287 N594 X175.706 Y-31.953 N595 X176.06 Y-32.49 N596 X176.423 Y-33.093 N597 X176.734 Y-33.693 N598 X177.014 Y-34.296 N599 X177.251 Y-34.897 N600 X177.511 Y-35.665 N601 X177.777 Y-36.703 N602 X177.885 Y-37.303 N603 X177.972 Y-37.906 N604 X178.024 Y-38.507 N605 X178.052 Y-39.11 N606 X178.05 Y-39.71 N607 X178.02 Y-40.312 N608 X177.961 Y-40.914 N609 X177.874 Y-41.516 N610 X177.757 Y-42.117 N611 X177.61 Y-42.72 N612 X177.432 Y-43.32 N613 X177.221 Y-43.923 N614 X176.908 Y-44.675 N615 X175.788 Y-46.924 N616 X175.241 Y-48.123 N617 X174.753 Y-49.321 N618 X174.317 Y-50.519 N619 X174.115 Y-51.118 N620 X173.744 Y-52.317 N621 X173.426 Y-53.515 N622 X173.03 Y-55.313 N623 X172.818 Y-56.511 N624 X172.588 Y-58.308 N625 X172.48 Y-59.506 N626 X172.421 Y-60.705 N627 X172.395 Y-61.903 N628 X172.389 Y-91.895 N629 X172.378 Y-92.496 N630 X172.32 Y-93.698 N631 X172.113 Y-95.81 N632 X171.769 Y-97.902 N633 X171.362 Y-99.704 N634 X170.846 Y-101.505 N635 X170.216 Y-103.307 N636 X169.612 Y-104.755 N637 Z41. F1000. N638 G0 Z200 M9 N639 M5 N640 M30 %
[править] Поиск/замена по шаблону
Поиск строк, содержащих код G1 или G01
# -*- coding: cp1251 -*- import re pattern = r'.*G1|G01.*' compile_pattern = re.compile(pattern, re.MULTILINE) for line in open('code.nc'): if compile_pattern.findall(line): print line
Замена G2 на G02
# -*- coding: cp1251 -*- import re pattern = r'.*G2|G02.*' compile_pattern = re.compile(pattern, re.MULTILINE) for line in open('code.nc'): # если написать compile_pattern.sub('G02', line) # т.е. по уже скомпилированному шаблону выполнить замену, # то в результате на G02 будет заменена вся строка, содержащая G2 s = re.sub('G2','G02',line) print s
Сформировать по исходному G-коду массив [x,y,z] координат перемещения инструмента с последующей записью в файл array.txt
# -*- coding: cp1251 -*- import re import numpy import copy x = re.compile('X([+-]?[0-9.]*)', re.MULTILINE) y = re.compile('Y([+-]?[0-9.]*)', re.MULTILINE) z = re.compile('Z([+-]?[0-9.]*)', re.MULTILINE) coordinats = [0,0,0] table = [] for line in open('code1.nc'): sx = x.search(line) sy = y.search(line) sz = z.search(line) if sx or sy or sz: # функция определния совпадающего с шаблоном текста m.groups() # возвращает кортеж, т.к. мы определяем только одно число # стоящее после X,Y,Z..., то надо сохранить только первый элемент # данного кортежа m.groups()[0] преобразовав его из строки в число if sx: coordinats[0] = float(sx.groups()[0]) if sy: coordinats[1] = float(sy.groups()[0]) if sz: coordinats[2] = float(sz.groups()[0]) # если написать просто table.append(coordinats), то будет # n-раз вставлена ссылка последнего значения массива coordinats # а не копия текущего значения table.append(copy.copy(coordinats)) # вывод значений в файл numpy.savetxt('array.txt', table, delimiter='\t', fmt="%5.4f")
Результирующий файл array.txt
0.0000 0.0000 0.0000 0.0000 0.0000 100.0000 0.0000 0.0000 55.0000 208.9600 -99.9630 55.0000 208.9600 -99.9630 14.0520 208.9600 -100.3960 13.6300 208.9600 -100.8530 13.2350 208.9600 -101.3330 12.8690 208.9600 -101.8350 12.5320 208.9600 -102.3550 12.2260 208.9600 -102.8940 11.9520 208.9600 -103.4480 11.7120 208.9600 -104.0150 11.5050 208.9600 -104.5940 11.3320 208.9600 -105.1830 11.1950 208.9600 -105.7780 11.0940 208.9600 -106.3790 11.0290 208.9600 -106.9820 11.0000 208.9600 -150.0780 11.0000 208.9350 -150.6750 11.0000 208.8690 -151.2720 11.0000 208.7630 -151.8700 11.0000 208.6250 -152.4280 11.0000 208.4200 -153.0640 11.0000 208.1780 -153.6610 11.0000 207.8840 -154.2580 11.0000 207.5300 -154.8550 11.0000 207.1100 -155.4530 11.0000 206.6090 -156.0500 11.0000 206.2370 -156.4330 11.0000 205.6390 -156.9630 11.0000 205.0420 -157.4070 11.0000 204.4450 -157.7800 11.0000 203.8480 -158.0920 11.0000 203.2500 -158.3500 11.0000 202.6530 -158.5580 11.0000 202.0560 -158.7210 11.0000 201.4590 -158.8410 11.0000 200.8620 -158.9190 11.0000 200.2650 -158.9560 11.0000 -0.0780 -158.9600 11.0000 -0.6750 -158.9350 11.0000 -1.2720 -158.8690 11.0000 -1.8700 -158.7630 11.0000 -2.4670 -158.6140 11.0000 -3.0120 -158.4390 11.0000 -3.6610 -158.1780 11.0000 -4.2580 -157.8840 11.0000 -4.8560 -157.5300 11.0000 -5.2730 -157.2440 11.0000 -6.0080 -156.6470 11.0000 -6.6090 -156.0500 11.0000 -7.1100 -155.4530 11.0000 -7.5310 -154.8550 11.0000 -7.8410 -154.3360 11.0000 -8.1780 -153.6610 11.0000 -8.4390 -153.0120 11.0000 -8.6140 -152.4670 11.0000 -8.7630 -151.8700 11.0000 -8.8690 -151.2720 11.0000 -8.9350 -150.6750 11.0000 -8.9600 -150.0780 11.0000 -8.9600 -0.1210 11.0000 -8.9470 0.4780 11.0000 -8.8950 1.0750 11.0000 -8.8030 1.6720 11.0000 -8.6680 2.2690 11.0000 -8.4890 2.8660 11.0000 -8.2640 3.4630 11.0000 -7.9870 4.0600 11.0000 -7.6540 4.6580 11.0000 -7.2570 5.2550 11.0000 -6.7850 5.8520 11.0000 -6.2200 6.4490 11.0000 -5.5350 7.0460 11.0000 -4.8550 7.5310 11.0000 -4.2580 7.8840 11.0000 -3.6610 8.1780 11.0000 -3.0640 8.4200 11.0000 -2.4670 8.6140 11.0000 -1.8690 8.7630 11.0000 -1.4760 8.8380 11.0000 -0.6750 8.9350 11.0000 -0.0780 8.9600 11.0000 200.2650 8.9560 11.0000 200.8620 8.9190 11.0000 201.4590 8.8410 11.0000 202.0560 8.7210 11.0000 202.6530 8.5580 11.0000 203.2500 8.3500 11.0000 203.8480 8.0920 11.0000 204.4450 7.7800 11.0000 205.0420 7.4070 11.0000 205.5340 7.0470 11.0000 206.2200 6.4490 11.0000 206.7850 5.8520 11.0000 207.2570 5.2550 11.0000 207.6540 4.6580 11.0000 207.9870 4.0600 11.0000 208.2640 3.4630 11.0000 208.4890 2.8660 11.0000 208.6250 2.4280 11.0000 208.8030 1.6720 11.0000 208.8950 1.0750 11.0000 208.9470 0.4780 11.0000 208.9600 -0.1210 11.0000 208.9600 -106.9820 11.0000 201.3600 -106.9820 11.0000 201.3600 -149.9180 11.0000 201.3520 -150.1020 11.0000 201.3250 -150.2900 11.0000 201.2720 -150.4680 11.0000 201.1950 -150.6390 11.0000 201.0810 -150.8150 11.0000 200.9730 -150.9430 11.0000 200.7550 -151.1240 11.0000 200.5770 -151.2260 11.0000 200.3990 -151.2960 11.0000 200.2190 -151.3380 11.0000 200.0250 -151.3560 11.0000 0.0820 -151.3600 11.0000 -0.1910 -151.3420 11.0000 -0.3820 -151.3010 11.0000 -0.5600 -151.2330 11.0000 -0.7410 -151.1340 11.0000 -1.0070 -150.9020 11.0000 -1.1530 -150.7120 11.0000 -1.2850 -150.4300 11.0000 -1.3420 -150.1910 11.0000 -1.3600 -149.9180 11.0000 -1.3600 -0.2020 11.0000 -1.3460 0.1620 11.0000 -1.3120 0.3410 11.0000 -1.2510 0.5200 11.0000 -1.1610 0.6980 11.0000 -1.0330 0.8740 11.0000 -0.8220 1.0720 11.0000 -0.6390 1.1950 11.0000 -0.4600 1.2750 11.0000 -0.2760 1.3270 11.0000 0.0820 1.3600 11.0000 200.0250 1.3560 11.0000 200.2190 1.3380 11.0000 200.3990 1.2960 11.0000 200.5770 1.2260 11.0000 200.7790 1.1090 11.0000 201.0330 0.8730 11.0000 201.2100 0.6090 11.0000 201.2910 0.4160 11.0000 201.3460 0.1620 11.0000 201.3600 -0.2020 11.0000 201.3600 -106.9820 11.0000 193.7600 -106.9820 11.0000 193.7600 -143.7420 11.0000 194.5310 -144.5280 11.0000 193.7460 -143.7560 11.0000 6.2540 -143.7600 11.0000 5.4690 -144.5310 11.0000 6.2400 -143.7460 11.0000 6.2400 -6.2540 11.0000 5.4680 -5.4690 11.0000 6.2540 -6.2400 11.0000 193.7460 -6.2440 11.0000 194.5320 -5.4720 11.0000 193.7600 -6.2580 11.0000 193.7600 -106.9820 11.0000 186.1600 -106.9820 11.0000 186.1600 -136.1420 11.0000 186.9310 -136.9280 11.0000 186.1460 -136.1560 11.0000 13.8540 -136.1600 11.0000 13.0690 -136.9310 11.0000 13.8400 -136.1450 11.0000 13.8400 -125.8770 11.0000 19.7430 -125.8770 11.0000 21.4540 -127.2210 11.0000 21.4470 -127.2300 11.0000 21.7250 -127.5170 11.0000 22.8180 -128.5530 11.0000 22.8270 -128.5450 11.0000 24.4910 -130.5790 11.0000 22.8130 -128.5590 11.0000 21.4540 -128.5590 11.0000 20.6690 -129.3310 11.0000 21.4400 -128.5450 11.0000 21.4400 -127.2350 11.0000 19.7430 -125.8770 11.0000 13.8400 -125.8770 11.0000 13.8400 -13.8550 11.0000 13.0680 -13.0690 11.0000 13.8540 -13.8400 11.0000 23.3790 -13.8410 11.0000 23.3790 -19.7900 11.0000 22.0820 -21.4550 11.0000 22.0730 -21.4480 11.0000 21.4470 -22.0790 11.0000 21.4540 -22.0880 11.0000 19.7570 -23.4230 11.0000 21.4400 -22.0730 11.0000 21.4400 -21.4550 11.0000 20.6680 -20.6690 11.0000 21.4540 -21.4410 11.0000 22.0670 -21.4410 11.0000 23.3790 -19.7900 11.0000 23.3790 -13.8410 11.0000 186.1460 -13.8440 11.0000 186.9320 -13.0720 11.0000 186.1600 -13.8580 11.0000 186.1600 -106.9820 11.0000 178.5600 -106.9820 11.0000 178.5600 -128.5420 11.0000 179.3310 -129.3280 11.0000 178.5460 -128.5570 11.0000 107.4560 -128.5580 11.0000 107.4560 -122.4550 11.0000 109.6290 -120.9440 11.0000 109.8570 -120.2880 11.0000 110.2130 -119.1100 11.0000 110.6300 -117.4390 11.0000 110.8670 -116.2790 11.0000 111.0210 -115.3060 11.0000 109.8350 -114.1900 11.0000 111.0370 -115.2940 11.0000 111.0290 -115.3020 11.0000 111.2820 -115.6040 11.0000 112.8780 -117.3500 11.0000 114.5360 -118.9480 11.0000 116.0980 -120.2870 11.0000 116.9600 -120.9510 11.0000 116.9690 -120.9440 11.0000 118.9540 -123.2520 11.0000 116.9550 -120.9580 11.0000 109.6380 -120.9580 11.0000 107.4560 -122.4550 11.0000 107.4560 -128.5580 11.0000 95.7320 -128.5580 11.0000 94.0540 -130.5760 11.0000 95.7180 -128.5440 11.0000 95.7260 -128.5510 11.0000 96.3360 -127.9910 11.0000 97.0560 -127.2740 11.0000 97.7760 -126.4920 11.0000 98.4910 -125.6430 11.0000 99.1630 -124.7620 11.0000 100.0980 -123.3810 11.0000 100.5570 -122.6140 11.0000 101.3070 -121.2210 11.0000 101.6740 -120.4360 11.0000 102.2590 -119.0070 11.0000 102.7370 -117.6060 11.0000 102.9530 -116.8440 11.0000 103.2880 -115.4500 11.0000 103.4320 -114.6770 11.0000 103.6370 -113.2330 11.0000 103.7530 -111.7840 11.0000 103.7840 -110.4900 11.0000 103.7840 -39.0550 11.0000 103.7610 -37.6750 11.0000 103.7140 -36.9130 11.0000 103.5710 -35.5170 11.0000 103.4620 -34.8110 11.0000 103.1810 -33.3620 11.0000 102.9950 -32.6080 11.0000 102.7850 -31.8760 11.0000 102.3300 -30.4770 11.0000 102.0270 -29.6920 11.0000 101.4240 -28.3250 11.0000 101.0610 -27.5960 11.0000 100.6300 -26.8090 11.0000 99.8400 -25.5210 11.0000 99.2610 -24.6770 11.0000 98.3780 -23.5180 11.0000 97.6570 -22.6740 11.0000 96.8770 -21.8450 11.0000 96.4600 -21.4490 11.0000 96.4510 -21.4560 11.0000 95.1690 -19.8100 11.0000 96.4650 -21.4420 11.0000 107.8190 -21.4420 11.0000 107.8190 -27.5900 11.0000 109.8710 -29.0400 11.0000 116.1270 -29.0420 11.0000 117.8330 -27.0260 11.0000 116.1420 -29.0560 11.0000 116.1320 -29.0490 11.0000 115.4280 -29.6210 11.0000 114.8300 -30.1470 11.0000 113.3910 -31.4870 11.0000 112.0640 -32.8630 11.0000 111.0420 -34.0390 11.0000 111.0500 -34.0470 11.0000 109.8390 -35.1570 11.0000 111.0340 -34.0340 11.0000 110.9280 -33.3870 11.0000 110.6870 -32.1280 11.0000 110.4230 -30.9750 11.0000 110.0210 -29.5530 11.0000 109.8610 -29.0540 11.0000 107.8190 -27.5900 11.0000 107.8190 -21.4420 11.0000 178.5460 -21.4430 11.0000 179.3320 -20.6720 11.0000 178.5600 -21.4580 11.0000 178.5600 -106.9820 11.0000 174.9560 -106.9820 11.0000 170.9600 -110.8330 11.0000 170.9600 -120.9430 11.0000 171.7310 -121.7280 11.0000 170.9460 -120.9570 11.0000 161.8080 -120.9570 11.0000 159.8150 -123.2480 11.0000 161.7940 -120.9430 11.0000 161.8030 -120.9510 11.0000 162.6870 -120.2650 11.0000 164.0550 -119.0990 11.0000 165.7850 -117.4500 11.0000 166.9840 -116.1690 11.0000 167.3980 -115.6960 11.0000 168.7170 -114.0810 11.0000 169.6580 -112.7960 11.0000 170.0700 -112.2000 11.0000 170.9540 -110.8280 11.0000 170.9460 -110.8190 11.0000 174.9560 -106.9820 11.0000 169.6120 -104.7550 11.0000 169.4650 -105.1090 11.0000 168.5090 -107.0490 11.0000 167.5600 -108.7120 11.0000 166.7080 -110.0320 11.0000 166.3740 -110.5130 11.0000 165.4910 -111.7150 11.0000 164.3060 -113.1590 11.0000 163.9900 -113.5160 11.0000 162.8640 -114.7170 11.0000 161.3030 -116.1970 11.0000 160.1010 -117.2130 11.0000 159.4460 -117.7190 11.0000 158.3000 -118.5680 11.0000 156.8570 -119.5220 11.0000 155.2970 -120.4350 11.0000 154.6970 -120.7530 11.0000 153.4950 -121.3570 11.0000 151.6930 -122.1440 11.0000 149.8910 -122.8080 11.0000 148.0900 -123.3560 11.0000 146.2890 -123.7920 11.0000 145.6880 -123.9170 11.0000 143.8860 -124.2180 11.0000 142.0840 -124.4170 11.0000 140.2820 -124.5150 11.0000 138.4820 -124.5130 11.0000 137.8800 -124.4900 11.0000 136.0790 -124.3610 11.0000 134.2770 -124.1310 11.0000 132.4750 -123.7970 11.0000 130.6740 -123.3580 11.0000 128.8720 -122.8090 11.0000 127.0710 -122.1440 11.0000 126.4700 -121.8940 11.0000 125.1910 -121.3220 11.0000 123.4670 -120.4380 11.0000 121.6650 -119.3720 11.0000 119.8640 -118.1390 11.0000 118.5400 -117.1180 11.0000 117.1460 -115.9170 11.0000 115.6600 -114.4760 11.0000 114.2420 -112.9140 11.0000 113.2580 -111.6980 11.0000 112.8210 -111.1130 11.0000 111.9670 -109.9110 11.0000 110.8420 -108.1090 11.0000 110.1820 -106.9090 11.0000 109.8690 -106.3080 11.0000 109.3000 -105.1080 11.0000 109.0340 -104.5070 11.0000 108.4530 -103.0650 11.0000 107.8530 -101.3070 11.0000 107.7310 -100.9030 11.0000 107.2500 -99.1010 11.0000 106.8770 -97.2990 11.0000 106.6080 -95.4970 11.0000 106.4400 -93.6960 11.0000 106.3730 -91.8950 11.0000 106.3670 -57.7040 11.0000 99.7840 -57.7040 11.0000 99.7840 -110.4900 11.0000 99.7540 -111.6930 11.0000 99.6510 -112.8950 11.0000 99.4730 -114.1040 11.0000 99.3590 -114.6970 11.0000 99.0670 -115.8980 11.0000 98.8930 -116.5010 11.0000 98.4780 -117.7030 11.0000 97.9790 -118.9040 11.0000 97.6930 -119.5060 11.0000 97.0420 -120.7070 11.0000 96.6760 -121.3090 11.0000 95.8570 -122.5110 11.0000 95.3260 -123.1980 11.0000 94.7240 -123.9060 11.0000 94.1230 -124.5540 11.0000 93.5220 -125.1480 11.0000 92.9210 -125.6960 11.0000 92.3200 -126.2010 11.0000 91.6510 -126.7180 11.0000 90.7900 -127.3190 11.0000 89.8200 -127.9200 11.0000 88.7140 -128.5210 11.0000 88.1130 -128.8100 11.0000 87.3970 -129.1220 11.0000 86.3090 -129.5370 11.0000 85.1070 -129.9100 11.0000 83.9050 -130.2080 11.0000 82.7030 -130.4240 11.0000 81.5010 -130.5690 11.0000 80.9000 -130.6080 11.0000 79.6990 -130.6480 11.0000 38.9100 -130.6480 11.0000 37.7080 -130.6180 11.0000 36.5050 -130.5150 11.0000 35.2340 -130.3230 11.0000 34.1010 -130.0850 11.0000 32.9000 -129.7540 11.0000 32.2990 -129.5590 11.0000 31.6970 -129.3400 11.0000 30.4960 -128.8390 11.0000 29.8260 -128.5200 11.0000 28.6920 -127.9020 11.0000 27.7490 -127.3180 11.0000 26.8890 -126.7160 11.0000 26.1200 -126.1160 11.0000 25.4190 -125.5140 11.0000 24.4850 -124.6230 11.0000 23.8840 -123.9810 11.0000 23.1480 -123.1100 11.0000 22.6830 -122.5060 11.0000 22.2580 -121.9090 11.0000 21.8640 -121.3080 11.0000 21.4810 -120.6750 11.0000 21.1630 -120.1060 11.0000 20.5630 -118.9030 11.0000 20.2790 -118.2480 11.0000 19.8470 -117.1010 11.0000 19.6490 -116.4980 11.0000 19.3220 -115.2980 11.0000 19.1840 -114.6970 11.0000 19.0680 -114.0950 11.0000 18.9760 -113.4940 11.0000 18.8310 -112.2910 11.0000 18.7670 -111.0890 11.0000 18.7610 -38.5090 11.0000 18.8090 -37.3060 11.0000 18.9300 -36.1040 11.0000 19.0770 -35.1930 11.0000 19.2520 -34.3020 11.0000 19.3950 -33.7010 11.0000 19.5610 -33.0990 11.0000 19.9530 -31.8970 11.0000 20.2790 -31.0570 11.0000 20.7070 -30.0950 11.0000 21.0050 -29.4940 11.0000 21.3270 -28.8930 11.0000 21.6790 -28.2900 11.0000 22.4720 -27.0890 11.0000 22.9170 -26.4880 11.0000 23.3970 -25.8870 11.0000 23.9180 -25.2860 11.0000 24.4870 -24.6850 11.0000 25.0950 -24.0840 11.0000 25.7660 -23.4830 11.0000 26.2900 -23.0470 11.0000 27.4920 -22.1570 11.0000 28.2230 -21.6800 11.0000 29.2940 -21.0610 11.0000 29.8950 -20.7480 11.0000 30.4960 -20.4610 11.0000 31.0980 -20.1990 11.0000 32.2990 -19.7430 11.0000 32.9020 -19.5450 11.0000 34.1020 -19.2180 11.0000 34.7040 -19.0800 11.0000 35.3050 -18.9640 11.0000 35.9060 -18.8710 11.0000 37.1090 -18.7260 11.0000 38.3110 -18.6620 11.0000 79.7000 -18.6530 11.0000 80.9030 -18.6880 11.0000 82.1050 -18.7950 11.0000 83.3050 -18.9810 11.0000 83.9060 -19.0940 11.0000 84.6850 -19.2760 11.0000 85.7090 -19.5680 11.0000 86.3110 -19.7650 11.0000 86.9120 -19.9860 11.0000 87.5130 -20.2310 11.0000 88.7150 -20.7810 11.0000 89.3160 -21.0950 11.0000 89.9170 -21.4380 11.0000 90.5180 -21.8070 11.0000 91.2270 -22.2810 11.0000 91.7210 -22.6360 11.0000 92.9230 -23.6070 11.0000 94.1250 -24.7480 11.0000 94.7250 -25.3950 11.0000 95.3270 -26.1050 11.0000 96.0710 -27.0900 11.0000 96.5280 -27.7650 11.0000 97.2160 -28.8930 11.0000 97.5400 -29.4940 11.0000 97.8370 -30.0950 11.0000 98.3630 -31.2960 11.0000 98.5910 -31.8990 11.0000 98.9770 -33.0990 11.0000 99.1480 -33.7010 11.0000 99.2930 -34.3020 11.0000 99.5330 -35.5610 11.0000 99.6140 -36.1050 11.0000 99.7330 -37.3070 11.0000 99.7680 -37.9080 11.0000 99.7840 -39.1090 11.0000 99.7840 -57.7040 11.0000 106.3670 -57.7040 11.0000 106.3940 -56.5030 11.0000 106.5160 -54.7000 11.0000 106.7380 -52.8980 11.0000 107.0640 -51.0970 11.0000 107.4940 -49.2970 11.0000 107.6600 -48.6950 11.0000 108.2350 -46.8930 11.0000 108.9280 -45.0910 11.0000 109.7470 -43.2900 11.0000 110.3690 -42.0900 11.0000 110.7030 -41.4890 11.0000 111.4570 -40.2250 11.0000 112.6590 -38.4500 11.0000 113.8600 -36.8940 11.0000 115.0870 -35.4820 11.0000 116.2620 -34.2730 11.0000 117.5480 -33.0810 11.0000 118.0630 -32.6310 11.0000 119.2640 -31.6620 11.0000 119.8650 -31.2180 11.0000 121.0670 -30.3690 11.0000 122.4830 -29.4770 11.0000 124.0680 -28.5940 11.0000 124.6910 -28.2760 11.0000 125.9600 -27.6760 11.0000 127.6720 -26.9730 11.0000 128.2730 -26.7530 11.0000 129.4730 -26.3490 11.0000 130.0740 -26.1660 11.0000 131.8770 -25.6900 11.0000 133.6790 -25.3200 11.0000 135.4800 -25.0550 11.0000 137.2820 -24.8910 11.0000 139.0820 -24.8280 11.0000 140.2840 -24.8390 11.0000 141.4850 -24.8960 11.0000 143.2860 -25.0700 11.0000 143.8880 -25.1500 11.0000 145.6900 -25.4630 11.0000 147.4920 -25.8860 11.0000 150.4900 -26.7700 11.0000 151.6880 -27.0550 11.0000 152.8860 -27.2740 11.0000 153.4840 -27.3620 11.0000 154.6820 -27.4880 11.0000 155.8790 -27.5510 11.0000 157.0770 -27.5510 11.0000 158.2740 -27.4870 11.0000 159.4720 -27.3610 11.0000 160.6700 -27.1710 11.0000 163.0710 -26.6680 11.0000 163.6710 -26.5850 11.0000 164.2740 -26.5260 11.0000 164.8750 -26.5010 11.0000 165.4780 -26.4970 11.0000 166.0780 -26.5280 11.0000 166.6810 -26.5820 11.0000 167.2820 -26.6680 11.0000 167.8840 -26.7810 11.0000 168.4850 -26.9260 11.0000 169.0870 -27.1010 11.0000 169.6900 -27.3100 11.0000 170.5720 -27.6760 11.0000 170.8920 -27.8300 11.0000 171.7210 -28.2780 11.0000 172.0950 -28.5090 11.0000 172.6980 -28.9170 11.0000 173.4230 -29.4820 11.0000 174.1000 -30.0840 11.0000 174.6870 -30.6860 11.0000 175.2000 -31.2870 11.0000 175.7060 -31.9530 11.0000 176.0600 -32.4900 11.0000 176.4230 -33.0930 11.0000 176.7340 -33.6930 11.0000 177.0140 -34.2960 11.0000 177.2510 -34.8970 11.0000 177.5110 -35.6650 11.0000 177.7770 -36.7030 11.0000 177.8850 -37.3030 11.0000 177.9720 -37.9060 11.0000 178.0240 -38.5070 11.0000 178.0520 -39.1100 11.0000 178.0500 -39.7100 11.0000 178.0200 -40.3120 11.0000 177.9610 -40.9140 11.0000 177.8740 -41.5160 11.0000 177.7570 -42.1170 11.0000 177.6100 -42.7200 11.0000 177.4320 -43.3200 11.0000 177.2210 -43.9230 11.0000 176.9080 -44.6750 11.0000 175.7880 -46.9240 11.0000 175.2410 -48.1230 11.0000 174.7530 -49.3210 11.0000 174.3170 -50.5190 11.0000 174.1150 -51.1180 11.0000 173.7440 -52.3170 11.0000 173.4260 -53.5150 11.0000 173.0300 -55.3130 11.0000 172.8180 -56.5110 11.0000 172.5880 -58.3080 11.0000 172.4800 -59.5060 11.0000 172.4210 -60.7050 11.0000 172.3950 -61.9030 11.0000 172.3890 -91.8950 11.0000 172.3780 -92.4960 11.0000 172.3200 -93.6980 11.0000 172.1130 -95.8100 11.0000 171.7690 -97.9020 11.0000 171.3620 -99.7040 11.0000 170.8460 -101.5050 11.0000 170.2160 -103.3070 11.0000 169.6120 -104.7550 11.0000 169.6120 -104.7550 41.0000 169.6120 -104.7550 200.0000
Добавление к номеру кадра 5-ти ведущих нулей
# -*- coding: cp1251 -*- import re import math pattern = re.compile('N([0-9]*)', re.MULTILINE) for line in open('code.nc'): m = pattern.search(line) if m: n = int( m.groups()[0] ) NewLine = pattern.sub('N'+"%05d"%n, line) print NewLine