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

Резултати

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

Пребарај: #applications

当前筛选 #applications清除筛选
djangoproject

@djangoproject · Post #450 · 27.09.2017 г., 11:51

https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django #Django is an extremely popular and fully featured server-side #web#framework, written in #Python. The module shows you why Django is one of the most popular web server frameworks, how to set up a development environment, and how to get started with using it to create your own web #applications. Prerequisites Before starting this module you don't need to have any knowledge of Django. You will need to understand what server-side web programming and web frameworks are, ideally by reading the topics in our Server-side website programming first steps module. A general knowledge of programming concepts and Python is recommended, but not essential to understanding the core concepts.

djangoproject

@djangoproject · Post #389 · 21.07.2017 г., 15:12

https://thinkster.io/topics/django Looking to build #fullstack apps with #Django? Looking to build a production ready Django #JSON#API? Building a Production Ready Django JSON API 🔸Setting up #JWT Authentication 🔸Profiles 🔸Articles 🔸Comments 🔸Following 🔸Favoriting 🔸Tagging 🔸Pagination 🔸Filtering 🔸Conclusion Configuring Django Settings for Production Building #Web#Applications with Django and #AngularJS 🔸Learning Django and AngularJS 🔸Setting up your environment 🔸Extending Django's built-in User model 🔸Serializing the Account Model 🔸Registering new users 🔸Logging users in 🔸Logging users out 🔸Making a Post model 🔸Rendering Post objects 🔸Making new posts 🔸Displaying user profiles 🔸Updating user profiles 🔸Congratulations, you did it!

GitHub Trends

@githubtrending · Post #14928 · 08.07.2025 г., 12:30

#other#applications#coding#codingchallenges#css#hacktoberfest#html#ideas#javascript#practice You can improve your coding skills by using a collection of app ideas that are organized by difficulty levels: beginner, intermediate, and advanced. Each project comes with clear goals, user stories to guide development, optional bonus features to enhance learning, and helpful resources. This helps you practice daily, experiment with new technologies, and build a portfolio to impress employers or clients. The projects range from simple tools like calculators to complex apps like chat systems or game engines. This structured approach makes learning coding practical, fun, and effective, helping you grow as a developer step-by-step. https://github.com/florinpop17/app-ideas

Venture Village Wall 🦄

@venturevillagewall · Post #3399 · 18.12.2024 г., 12:10

eLstar Dynamics Raises $10.48M eLstar Dynamics has successfully closed a $10.48 million funding round on December 17, 2024. Their innovative smart glass technology promotes controlled and sustainable visual comfort, finding applications in a wide range of industries due to its versatility and design. #Funding#SmartGlass#Sustainability#Innovation#eLstarDynamics#Technology#VisualComfort#Design#Applications#Versatility

GitHub Trends

@githubtrending · Post #14777 · 03.06.2025 г., 00:00

#other#applications#coderquad#college#fulltime#hacktoberfest#jobs#newgrad#position#posting#university This resource is a regularly updated list of entry-level jobs for new graduates in software, tech, computer science, product management, and quantitative roles for 2024 and 2025, organized by Coder Quad and Simplify[1][2][4]. It features a wide range of open positions from top companies, sorted by category like software engineering, data science, AI, quantitative finance, and hardware engineering. The list is easy to browse, with direct links to apply for each job, and is updated daily so you always see the latest opportunities. You can also use tools like Simplify’s browser extension to autofill job applications and get email alerts for new roles, saving you time and effort. This helps you quickly find and apply for jobs that match your skills and interests, making your job search much easier and more efficient[1][2][4]. https://github.com/SimplifyJobs/New-Grad-Positions

Venture Village Wall 🦄

@venturevillagewall · Post #3604 · 20.12.2024 г., 17:23

Navigating AI Opportunities & Threats Explore how AI presents both challenges and opportunities for small businesses. While larger firms dominate the market, many entrepreneurs can thrive with modest revenue targets. AI could lead to the decline of SaaS businesses due to cost-effective alternatives. However, it allows individuals to quickly replicate and improve existing applications, catering to proven market needs. Though scaling to $500M ARR is tough in niches, a small investment can create meaningful products. Innovators can introduce multiple unique offerings, even in shadow of larger tech giants. #AI#SaaS#Business#Investment#Tech#Entrepreneurship#Revenue#ProductDevelopment#Innovation#Market#Growth#Web3#Startups#Opportunity#Threats#SmallBusiness#Investors#ExistingMarket#Applications#PMF#CostEfficiency

Venture Village Wall 🦄

@venturevillagewall · Post #3395 · 18.12.2024 г., 12:10

Orqa Secures $6.09M Funding Orqa d.o.o., founded in 2018, has raised $6.09 million as of December 13, 2024. The company aims to become the leading technology provider for First Person View (FPV) and advanced Remote Reality (RR) applications, focusing on next-generation vision systems. More info at Orqa. #Funding#FPV#Technology#RemoteReality#VisionSystems#Orqa#Innovation#Investments#Startups#Drones#Development#Applications#NextGen#TechnologyProvider#TechIndustry#Entrepreneurship#R&D