TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #22 · 19 јан.

Заметка начинающим, которые часто сталкиваются с подобной непоняткой. Ситуация следующая, есть список файлов: names = [ 'image.bmp', 'second.txt.bkp', 'data.db', '.config.cfg', 'file.ext.bkp' ] И мы хотим убрать у них окончание ".bkp". Не знаю зачем, пример довольно надуманный) Но суть он показывает, а это главное. Те, кто еще не очень знаком с библиотекой os.path или pathlib, вероятно решат обработать имена как строки. И тут вполне подойдет метод строки strip(). Что делает этот метод? Он отрезает указанные символы по обеим сторонам строки. Если ничего не указать, то убирает невидимые символы (пробелы, табуляции и переносы строк). В нашем случае будет выглядеть вот так: >>> name.strip('.bkp') То есть просим удалить строку '.bkp' по краям имени файла, если таковая есть. Можно применить аналогичный метод rstrip(), чтобы отрезать только справа, но для этого примера используем обычный. >>> for name in names: >>> print(name.strip('.bkp')) image.bm second.txt data.d config.cfg file.ext Хм, что-то не то с нашими именами! Что случилось??? Видим нежелательное переименование в именах, где и близко не было указанной строки '.bkp' А дело всё в том, что данный метод ищет не указанную строку, а указанные символы, и не важно в каком порядке. Для метода strip() строка '.bkp' это не паттерн для поискаа список символов. Потому он отрезал симовол 'p' от '.bmp' и удалил точку из файла '.config.cfg'. Как тогда правильно заменить именно паттерн? Для начинающего можно посоветовать метод строки replace(), который как раз использует для замены указанную строку целиком. В нашем примере заменим её на пустую строку. >>> for name in names: >>> print(name.replace('.bkp', '')) image.bmp second.txt data.db .config.cfg file.ext Уже лучше, но помните, это лишь пример про strip(). Для работы с именами файлов есть способы и более "правильные", дающие однозначно верный результат. Я взял файлы только в качестве примера. Даже replase() тут может сделать не то что ожидаем. Просто впредь будьте внимательны с этим strip(). #basic

Hashtags

Резултати

Пронајдени 6 слични објави

Пребарај: #taxtransparency

当前筛选 #taxtransparency清除筛选
IRAS

@irassg · Post #1578 · 25.06.2025 г., 07:43

We are grateful to the participants for their strong commitment to enhancing tax transparency and combating cross-border tax evasion. IRAS remains dedicated to collaborating closely with industry partners to facilitate a smooth implementation process. #LifeatIRAS#internationaltax#taxtransparency

IRAS

@irassg · Post #1815 · 04.11.2025 г., 05:43

Ever wondered how Singapore stays at the forefront of global tax cooperation? Our active participation in international discussions is one way we do so 💪 Just a few weeks ago, Deputy Director Pang Cheng Jong and Senior Manager Kenneth Lim from the International Tax and Relations Division represented the #IRASFam at the 48th OECD Working Party 10 meeting, contributing to crucial discussions that shape the future of international tax transparency and compliance. Our team engaged with the OECD Business Advisory Group on the Amended Common Reporting Standard (CRS) and Crypto-Asset Reporting Framework (CARF), and worked with government delegates to develop interpretative guidance for both standards – work that will directly impact how these frameworks are implemented globally 🌍 Our active participation reflects Singapore’s longstanding commitment to international tax cooperation and reinforces our role as a trusted partner on the global stage 🤝 #LifeatIRAS#internationaltax#taxtransparency

IRAS

@irassg · Post #1570 · 24.06.2025 г., 07:07

💫 Proud to share that our #IRASFam represented Singapore at the 18th Automatic Exchange of Information (AEOI) Peer Review Group meeting, where Senior Assistant Director Ang Ming Kwan (International Tax and Relations Division – Exchange of Information Branch) participated as an International Peer Review Assessor alongside colleagues from the Global Forum Secretariat. Our team also engaged in productive discussions on maintaining consistency in peer review standards and made interventions to champion a level playing field for all jurisdictions. 🤝 Building meaningful connections with the Global Forum Secretariat members and fellow tax administrators has been invaluable. These partnerships drive our shared mission of advancing international tax transparency and compliance. #lifeatIRAS#taxtransparency#internationalrelations

IRAS

@irassg · Post #1402 · 24.02.2025 г., 07:59

Earlier this month, together with MOF, our colleagues from the International Tax and Relations Division represented #IRASFam at the 20th Working Group on ASEAN Forum on Taxation. This meeting provided a platform for ASEAN Member States to learn about key international tax issues, including tax transparency, Base Erosion and Profit Shifting (BEPS) and UN developments. During the forum, our team shared Singapore’s approach and progress in implementing the Crypto Asset Reporting Framework (CARF). Tax Director Gordon Cheong highlighted Singapore's enduring commitment to international tax transparency standards on Exchange of Information on Request, Common Reporting Standard and CARF. We are grateful for this valuable opportunity to strengthen relationships and foster knowledge sharing with our ASEAN counterparts, reinforcing our commitment to regional collaboration in tax administration. #LifeatIRAS#taxtransparency#ASEANcollaboration

IRAS

@irassg · Post #1869 · 26.11.2025 г., 02:10

Our team shared Singapore's journey in implementing the Amended Common Reporting Standard (CRS). Manager Nicole Kan highlighted both Singapore’s implementation progress in accordance with internationally agreed tax transparency standards and our philosophy that robust tax transparency standards are best achieved through genuine partnership with industry stakeholders. This collaborative approach has been instrumental in Singapore's successful CRS implementation. The ASEAN forum reinforced that regional cooperation is essential - through shared experiences in digitalisation, transparency, and tax certainty, ASEAN administrations can build stronger, more efficient systems that benefit businesses and citizens alike 💪 #LifeatIRAS#taxtransparency#ASEANcollaboration#internationaltax

IRAS

@irassg · Post #1253 · 29.11.2024 г., 09:10

🎤 Assistant Commissioner Angela Ang contributed as a panellist, sharing our insights on the Common Reporting Standard. She wore two hats – one as an AEOI Peer Review Group member and another as an Assessed Jurisdiction. 🤝 Tax Director Gordon Cheong chimed in too, emphasising how we had teamed up with industry partners to implement CRS. He highlighted that we will continue to closely engage and partner with the industry as we implement the amended CRS and CARF in the coming years. Read our announcement here and discover more about the Global Forum plenary meeting here. #GlobalForum#AEOI#AutomaticExchangeOfInformation#CARF#TaxTransparency#GFplenary2024