Архив рубрики: Публикации

Как переименовать расширение файла в Python

Задача: в папке лежит файл с расширением .raw и мне нужно переименовать этот файл на такой же, но с другим расширением .txt – как это делать?

Решение:

Нужно импортировать модуль os, у которого есть методы os.path.splitext() и os.rename(). Методом os.path.splitext() можно разделить исходный файл на две части – его имя и разрешение, которое попадает в квадратные скобки как [0] – имя и [1] – разрешение. Далее нужно просто склеить имя с новым разрешением через os.rename(). Читать

Install Google Adsense in wordpress manually

Often the wordpress plugin “Google Adsense” does not see the right place for advertising in the template. In this case, the most convenient way is to insert a special code in the right place of the site:

<ins id="sidebar-123"

style="display: none;"

class="adsbygoogle-placeholder"></ins>

Along sidebar-123, specify any unique identifier, even 31415926.

 

After that, once again test the site google plugin – and voila, he will find the right place for advertising, which had not seen before!

 

That the code does not have to re-insert when you update the template (now it is automatic), it makes sense to insert the code through a widget as text 🙂


How to write Python code in Notepad++

If you love Notepad and want to program with it, then in the case of the Python programming language, you need to use a special plugin. There are several plugin options for Notepad++ that interpret Python:

  • nppexec;
  • Python script;
  • PyNPP.

Читать

How to change the title of a wordpress site

To change the display of the title – the title of the site that appears in the browser – you must do the following:

 

  • go to the dashboard of the site
  • сhoose All in One SEO (if you do not have this plugin, this method will not help)
  • scroll down to Homepage settings and change Home Title

Читать

How to insert google adsense ads on a wordpress site

After the abolition of the plugin for automatic embedding ads on a site under wordpress, I got discouraged and started googling what to do. In this post I’ll tell you my way of inserting ads into the site, which is not written anywhere. Source: wordpress, hueman theme, manually generated responsive ads google adsense ad units, suitable for mobile devices.

Читать

How to rename a file extension in Python

Task: there is a file with the .raw extension in the folder and I need to rename this file to the same one, but with a different .txt extension – how can I do this?

Solution:

You need to import the os module, which has the os.path.splitext() and os.rename() methods. Using the os.path.splitext() method, you can split the source file into two parts – its name and permission, which falls into square brackets as [0] – name and [1] – permission. Next, you just need to glue the name with the new permission via os.rename(). Читать