使用正则表达式获取字符串作为浮点变量

时间:2020-06-22 17:05:14

标签: python python-3.x regex

有一个包含内容的文件:

OR

我想在标题具有诸如abc_4abk_keys44a之类的键的所有模块中从B.dim中提取2.642,为此,我首先需要搜索键,然后在该模块中,从START'keyword'到END'keyword',然后提取2.642作为浮点型变量。我不知道要使用的正则表达式,有人可以帮助我吗?

ON abc_4abk_keys44a
keyword : c
START c
hashtags;
START
student_4e;
END
professor_u6;
topper_98j;
A.dim 3.246 burst R1;
B.dim 2.642 burst R6;
K.dimension 3.564 burst L4;
END c
ON amc_4sn_bname1
keyword : k4
START k4
hashtags;
START
student_4e;
END
professor_u6;
topper_98j;
A.dim 3.246 burst R1;
B.dim 2.642 burst R6;
K.dimension 3.564 burst L4;
END k4

1 个答案:

答案 0 :(得分:0)

使用char d[42]而不是使用正则表达式在空格处分割每一行。

遍历所有行,并设置一个变量,该变量指示您是否处于与Response.Clear(); Response.AppendHeader("username", "Username"); Response.AppendHeader("password", "abc"); Response.Status = "301 Moved permanently"; Response.AppendHeader("Location", "https://test.local.com"); Response.End(); 匹配的单位中。

 - Installing smatar/laravel-settings (1.3): Downloading (failed)    Failed to download smatar/laravel-settings from dist: The "https://api.github.com/repos/SMATAR/laravel-settings/zipball/7b76462fe90224688c632d90c5f84a28c0f6e2bc" file could not be downloaded (HTTP/1.1 404 Not Found)
    Now trying to download from source
  - Installing smatar/laravel-settings (1.3): The authenticity of host 'github.com (18.231.5.6)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Cloning 7b76462fe9


  [RuntimeException]
  Failed to clone https://github.com/SMATAR/laravel-settings.git via https, ssh protocols, aborting.
  - https://github.com/SMATAR/laravel-settings.git
    Cloning into '/var/www/html/prod/web/vendor/smatar/laravel-settings'...
    remote: Invalid username or password.
    fatal: Authentication failed for 'https://github.com/SMATAR/laravel-settings.git/'
  - git@github.com:SMATAR/laravel-settings.git
    Cloning into '/var/www/html/prod/web/vendor/smatar/laravel-settings'...
    Warning: Permanently added the RSA host key for IP address '18.228.67.229' to the list of known hosts.
    Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
相关问题